Part Number Hot Search : 
1M0880 87759 SMD1210 5VXR220 PC818 RMCP8CG TGH22A BCW68G
Product Description
Full Text Search
 

To Download M30260M3A-XXXGP Datasheet File

  If you can't view the Datasheet, Please click here to try to view without PDF Reader .  
 
 


  Datasheet File OCR Text:
  rene s a s 1 6 -bit s in g le- c hip mi c r oco mp u te r m16 c family / m16 c /tin y s erie s m16c/26a group (m16c/26a, m16c/26b, m16c/26t) 16 rev. 2.00 revision date: feb.15, 2007 hardware manual www.renesas.com all information contained in these materials, including products and product specifications, represents information on the product at the time of publication and is subject to change by renesas technology corp. without notice. please review the latest information published by renesas technology corp. through various means, including the renesas technology corp. website (http://www.renesas.com). rej09b0202-0200
1. this document is provided for reference purposes only so that renesas customers may select the appropriate renesas products for their use. renesas neither makes warranties or representations with respect to the accuracy or completeness of the information contained in this document nor grants any license to any intellectual property rights or any other rights of renesas or any third party with respect to the information in this document. 2. renesas shall have no liability for damages or infringement of any intellectual property or other rights arising out of the use of any information in this document, including, but not limited to, product data, diagrams, charts, programs, algorithms, and application circuit examples. 3. you should not use the products or the technology described in this document for the purpose of military applications such as the development of weapons of mass destruction or for the purpose of any other military use. when exporting the products or technology described herein, you should follow the applicable export control laws and regulations, and procedures required by such laws and regulations. 4. all information included in this document such as product data, diagrams, charts, programs, algorithms, and application circuit examples, is current as of the date this document is issued. such information, however, is subject to change without any prior notice. before purchasing or using any renesas products listed in this document, please confirm the latest product information with a renesas sales office. also, please pay regular and careful attention to additional and different information to be disclosed by renesas such as that disclosed through our website. (http://www.renesas.com ) 5. renesas has used reasonable care in compiling the information included in this document, but renesas assumes no liability whatsoever for any damages incurred as a result of errors or omissions in the information included in this document. 6. when using or otherwise relying on the information in this document, you should evaluate the information in light of the total system before deciding about the applicability of such information to the intended application. renesas makes no representations, warranties or guaranties regarding the suitability of its products for any particular application and specifically disclaims any liability arising out of the application and use of the information in this document or renesas products. 7. with the exception of products specified by renesas as suitable for automobile applications, renesas products are not designed, manufactured or tested for applications or otherwise in systems the failure or malfunction of which may cause a direct threat to human life or create a risk of human injury or which require especially high quality and reliability such as safety systems, or equipment or systems for transportation and traffic, healthcare, combustion control, aerospace and aeronautics, nuclear power, or undersea communication transmission. if you are considering the use of our products for such purposes, please contact a renesas sales office beforehand. renesas shall have no liability for damages arising out of the uses set forth above. 8. notwithstanding the preceding paragraph, you should not use renesas products for the purposes listed below: (1) artificial life support devices or systems (2) surgical implantations (3) healthcare intervention (e.g., excision, administration of medication, etc.) (4) any other purposes that pose a direct threat to human life renesas shall have no liability for damages arising out of the uses set forth in the above and purchasers who elect to use renesas products in any of the foregoing applications shall indemnify and hold harmless renesas technology corp., its affiliated companies and their officers, directors, and employees against any and all damages arising out of such applications. 9. you should use the products described herein within the range specified by renesas, especially with respect to the maximum rating, operating supply voltage range, movement power voltage range, heat radiation characteristics, installation and other product characteristics. renesas shall have no liability for malfunctions or damages arising out of the use of renesas products beyond such specified ranges. 10. although renesas endeavors to improve the quality and reliability of its products, ic products have specific characteristics such as the occurrence of failure at a certain rate and malfunctions under certain use conditions. please be sure to implement safety measures to guard against the possibility of physical injury, and injury or damage caused by fire in the event of the failure of a renesas product, such as safety design for hardware and software including but not limited to redundancy, fire control and malfunction prevention, appropriate treatment for aging degradation or any other applicable measures. among others, since the evaluation of microcomputer software alone is very difficult, please evaluate the safety of the final products or system manufactured by you. 11. in case renesas products listed in this document are detached from the products to which the renesas products are attached or affixed, the risk of accident such as swallowing by infants and small children is very high. you should implement safety measures so that renesas products may not be easily detached from your products. renesas shall have no liability for damages arising out of such detachment. 12. this document may not be reproduced or duplicated, in any form, in whole or in part, without prior written approval from renesas. 13. please contact a renesas sales office if you have any questions regarding the information contained in this document, renesas semiconductor products, or if you have any other inquiries. notes regarding these materials
general precautions in the handling of mpu/mcu products the following usage notes are applicable to all mpu/mcu products from renesas. for detailed usage notes on the products covered by this manual, refer to the rele vant sections of the manu al. if the descriptions under general precautions in the handling of mpu/mcu products and in the body of the manual differ from each other, the description in the bod y of the manual takes precedence. 1. handling of unused pins handle unused pins in accord with the directi ons given under handling of unused pins in the manual. ? the input pins of cmos products are general ly in the high-impedance state. in operation with an unused pin in the open-circuit state, extra electromagnetic noise is induced in the vicinity of lsi, an associated shoot-through cu rrent flows internally, and malfunctions occur due to the false recognition of the pin state as an input signal become possible. unused pins should be handled as described under handling of unused pins in the manual. 2. processing at power-on the state of the product is undefined at the moment when power is supplied. ? the states of internal circuits in the lsi are indeterminate and the states of register settings and pins are undefined at t he moment when power is supplied. in a finished product where the reset signal is applied to the external reset pin, the states of pins are not guaranteed from the moment when power is supplied until the reset process is completed. in a similar way, the states of pins in a pr oduct that is reset by an on-chip power-on reset function are not guaranteed from the moment when power is supplied until the power reaches the level at which resetting has been specified. 3. prohibition of access to reserved addresses access to reserved addresses is prohibited. ? the reserved addresses are provided for the po ssible future expansion of functions. do not access these addresses; the correct operat ion of lsi is not guaranteed if they are accessed. 4. clock signals after applying a reset, only release the reset line after the operating clock signal has become stable. when switching the clock signal during pr ogram execution, wait until the target clock signal has stabilized. ? when the clock signal is generated with an external resonator (or from an external oscillator) during a reset, ensure that the reset li ne is only released after full stabilization of the clock signal. moreover, when switching to a clock signal produced with an external resonator (or by an external oscillator) while program execution is in progress, wait until the target clock signal is stable. 5. differences between products before changing from one product to another, i.e. to one with a different part number, confirm that the change will not lead to problems. ? the characteristics of mpu/mcu in the same group but having different part numbers may differ because of the differences in internal memory capacity and layout pattern. when changing to products of different part numbe rs, implement a system-evaluation test for each of the products.
how to use this manual 1. purpose and target readers this manual is designed to provide the user with an understanding of the hardwa re functions and electrical characteristics of the mcu. it is intended for users de signing application systems incorporating the mcu. a basic knowledge of electric circuits, logi cal circuits, and mcus is necessa ry in order to use this manual. the manual comprises an overview of the product; descriptions of the cpu, system control functions, peripheral functions, and electrical charac teristics; and usage notes. particular attention should be paid to the precautio nary notes when using the manual. these notes occur within the body of the text, at the end of each section, and in the usage notes section. the revision history summarizes the loca tions of revisions and additions. it does not list all revisions. refer to the text of the manual for details. the following documents apply to the m16c/26a grou p (m16c/26a, m16c/26b, and m16c/26t). make sure to refer to the latest versions of these documents. the newest versions of the documents listed may be obtained from the renesas technology web site. document type description document title document no. hardware manual hardware specifications (pin assignments, memory maps, peripheral function specifications, electrical characteristics, timing charts) and operation description note: refer to the applic ation notes for details on using peripheral functions. m16c/26a group (m16c/26a, m16c/26b, m16c/26t) hardware manual this hardware manual software manual description of cpu instruction set m16c/60, m16c/20, m16c/tiny series software manual rej09b0137 application note information on using peripheral functions and application examples sample programs information on writing programs in assembly language and c available from renesas technology web site. renesas technical update product specifications, updates on documents, etc.
2. notation of numbers and symbols the notation conventions for register na mes, bit names, numbers, and symbols used in this manual are described below. (1) register names, bit names, and pin names registers, bits, and pins are referred to in the text by symbols. the symbol is accompanied by the word ?register,? ?bit,? or ?pin? to distinguish the three categories. examples the pm03 bit in the pm0 register p3_5 pin, vcc pin (2) notation of numbers the indication ? 2 ? is appended to numeric values given in binary format. however, nothing is appended to the values of single bits. the indication ? 16 ? is appended to numeric values given in hexadecimal format. nothing is appended to numeric values given in decimal format. examples binary: 11 2 hexadecimal: efa0 16 decimal: 1234
3. register notation the symbols and terms used in register diagrams are described below. *1 blank: set to 0 or 1 acco rding to the application. 0: set to 0. 1: set to 1. x: nothing is assigned. *2 rw: read and write. ro: read only. wo: write only. ? : nothing is assigned. *3 ? reserved bit reserved bit. set to specified value. *4 ? nothing is assigned nothing is assigned to the bit. as the bit may be used for future functions, if necessary, set to 0. ? do not set to a value operation is not guaranteed when a value is set. ? function varies according to the operating mode. the function of the bit varies with the peripheral functi on mode. refer to the regist er diagram for information on the individual modes. xxx register symbol address after reset xxx xxx 00 16 bit name bit symbol rw b7 b6 b5 b4 b3 b2 b1 b0 xxx bits 1 0: xxx 0 1: xxx 1 0: do not set. 1 1: xxx b1 b0 xxx1 xxx0 xxx4 reserved bits xxx5 xxx7 xxx6 function nothing is assigned. if necessary, set to 0. when read, the content is undefined. xxx bit function varies according to the operating mode. set to 0. 0 (b3) (b2) rw rw rw rw wo rw ro xxx bits 0: xxx 1: xxx *1 *2 *3 *4
4. list of abbrevia tions and acronyms abbreviation full form acia asynchronous communication interface adapter bps bits per second crc cyclic redundancy check dma direct memory access dmac direct memory access controller gsm global system for mobile communications hi-z high impedance iebus inter equipment bus i/o input/output irda infrared data association lsb least significant bit msb most significant bit nc non-connection pll phase locked loop pwm pulse width modulation sfr special function registers sim subscriber identity module uart universal asynchrono us receiver/transmitter vco voltage controlled oscillator all trademarks and registered trademarks ar e the property of their respective owners. iebus is a registered trademark of nec electronics corporation.
a-1 table of contents quick reference by address _______________________ b-1 1. overview ______________________________________ 1 1.1 applications ............................................................................................................... .... 1 1.2 performance outline ..................................................................................................... 2 1.3 block diagram .............................................................................................................. .4 1.4 product list ............................................................................................................... .... 6 1.5 pin assignments .......................................................................................................... 11 1.6 pin description ............................................................................................................ 15 2. central processing unit (cpu) ____________________ 17 2.1 data registers (r0, r1, r2 and r3) ........................................................................... 17 2.2 address registers (a0 and a1) ................................................................................... 17 2.3 frame base register (fb) .......................................................................................... 18 2.4 interrupt table register (intb) ................................................................................... 18 2.5 program counter (pc) ................................................................................................ 18 2.6 user stack pointer (usp) and interrupt stack pointer (isp) ...................................... 18 2.7 static base register (sb) ........................................................................................... 18 2.8 flag register (flg) .................................................................................................... 18 2.8.1 carry flag (c flag) .............................................................................................. 18 2.8.2 debug flag (d flag) ............................................................................................ 18 2.8.3 zero flag (z flag) ............................................................................................... 18 2.8.4 sign flag (s flag) ................................................................................................ 18 2.8.5 register bank select flag (b flag) ...................................................................... 18 2.8.6 overflow flag (o flag) ......................................................................................... 18 2.8.7 interrupt enable flag (i flag) ............................................................................... 18 2.8.8 stack pointer select flag (u flag) ....................................................................... 18 2.8.9 processor interrupt priority level (ipl) ................................................................ 18 2.8.10 reserved area ................................................................................................... 18 3. memory ______________________________________ 19 4. special function registers (sfrs) _________________ 20
a-2 5. reset ________________________________________ 26 5.1 hardware reset .......................................................................................................... 26 5.1.1 hardware reset 1 ................................................................................................ 26 5.1.2 hardware reset 2 ................................................................................................ 26 5.2 software reset ............................................................................................................ 2 7 5.3 watchdog timer reset ................................................................................................ 27 5.4 oscillation stop detection reset ................................................................................. 27 5.5 voltage detection circuit ............................................................................................. 29 5.5.1 voltage down detection interrupt ....................................................................... 32 5.5.2 limitations on exiting stop mode ........................................................................ 34 5.5.3 limitations on exiting wait mode ........................................................................ 34 6. processor mode _______________________________ 35 7. clock generation circuit _________________________ 38 7.1 main clock ................................................................................................................. .45 7.2 sub clock .................................................................................................................. .. 46 7.3 on-chip oscillator clock .............................................................................................. 47 7.4 pll clock .................................................................................................................. .. 47 7.5 cpu clock and peripheral function clock ................................................................. 49 7.5.1 cpu clock ........................................................................................................... 49 7.5.2 peripheral function clock (f 1 , f 2 , f 8 , f 32 , f 1sio , f 2sio , f 8sio , f 32sio , f ad , f c32 ) ....... 49 7.5.3 clockoutput function .......................................................................................... 49 7.6 power control ............................................................................................................. 5 0 7.6.1 normal operation mode ....................................................................................... 50 7.6.2 wait mode ............................................................................................................ 51 7.6.3 stop mode ........................................................................................................... 53 7.7 system clock protective function .............................................................................. 57 7.8 oscillation stop and re-oscillation detect function ................................................... 57 7.8.1 operation when the cm27 bit is set to "0" (oscillation stop detection reset) ... 58 7.8.2 operation when the cm27 bit is set to "1" (oscillation stop and re-oscillation detect interrupt) .................. 58 7.8.3 how to use oscillation stop and re-oscillation detect function ......................... 59 8. protection ____________________________________ 60 9. interrupt ______________________________________ 61 9.1 type of interrupts ........................................................................................................ 6 1 9.1.1 software interrupts ............................................................................................... 62 9.1.2 hardware interrupts ............................................................................................. 63
a-3 9.2 interrupts and interrupt vector .................................................................................... 64 9.2.1 fixed vector tables .............................................................................................. 64 9.2.2 relocatable vector tables ................................................................................... 65 9.3 interrupt control .......................................................................................................... 66 9.3.1 i flag ................................................................................................................... .69 9.3.2 ir bit ................................................................................................................... .69 9.3.3 ilvl2 to ilvl0 bits and ipl ................................................................................. 69 9.4 interrupt sequence ...................................................................................................... 70 9.4.1 interrupt response time...................................................................................... 71 9.4.2 variation of ipl when interrupt request is accepted ........................................... 71 9.4.3 saving registers .................................................................................................. 72 9.4.4 returning from an interrupt routine .................................................................... 74 9.5 interrupt priority ......................................................................................................... .. 74 9.5.1 interrupt priority resolution circuit ...................................................................... 74 ______ 9.6 int interrupt .............................................................................................................. .. 76 ______ 9.7 nmi interrupt .............................................................................................................. .77 9.8 key input interrupt ....................................................................................................... 7 7 9.9 address match interrupt .............................................................................................. 78 10. watchdog timer ______________________________ 80 10.1 count source protective mode ................................................................................. 81 11. dmac ______________________________________ 82 11.1 transfer cycles......................................................................................................... 8 7 11.2. dma transfer cycles ................................................................................................ 89 11.3 dma enable............................................................................................................... 9 0 11.4 dma request ............................................................................................................ 90 11.5 channel priority and dma transfer timing .............................................................. 91 12. timer _______________________________________ 92 12.1 timer a .................................................................................................................. ... 94 12.1.1. timer mode ....................................................................................................... 97 12.1.2. event counter mode ......................................................................................... 98 12.1.3. one-shot timer mode ..................................................................................... 103 12.1.4. pulse width modulation (pwm) mode ............................................................ 105 12.2 timer b .................................................................................................................. . 108 12.2.1 timer mode ..................................................................................................... 111 12.2.2 event counter mode ........................................................................................ 112 12.2.3 pulse period and pulse width measurement mode ....................................... 113 12.2.4 a/d trigger mode ............................................................................................ 115
a-4 12.3 three-phase motor control timer function ............................................................ 117 12.3.1 position-data-retain function ........................................................................... 128 12.3.2 three-phase/port output switch function ....................................................... 130 13. serial i/o ___________________________________ 132 13.1. uarti (i=0 to 2)...................................................................................................... 132 13.1.1. clock synchronous serial i/o mode ................................................................ 142 13.1.2. clock asynchronous serial i/o (uart) mode ................................................ 150 13.1.3 special mode 1 (i 2 c bus mode)(uart2) ......................................................... 158 13.1.4 special mode 2 (uart2) ................................................................................. 168 13.1.5 special mode 3 (ie bus mode )(uart2) ........................................................ 173 13.1.6 special mode 4 (sim mode) (uart2) ............................................................ 175 14. a/d converter _______________________________ 180 14.1 operation modes ..................................................................................................... 186 14.1.1 one-shot mode ................................................................................................ 186 14.1.2 repeat mode ................................................................................................... 188 14.1.3 single sweep mode ........................................................................................ 190 14.1.4 repeat sweep mode 0 .................................................................................... 192 14.1.5 repeat sweep mode 1 .................................................................................... 194 14.1.6 simultaneous sample sweep mode ................................................................ 196 14.1.7 delayed trigger mode 0 ................................................................................... 199 14.1.8 delayed trigger mode 1 ................................................................................... 205 14.2 resolution select function ..................................................................................... 211 14.3 sample and hold ..................................................................................................... 211 14.4 power consumption reducing function ................................................................. 211 14.5 output impedance of sensor under a/d conversion .............................................. 212 15. crc calculation circuit _______________________ 213 15.1. crc snoop ............................................................................................................ 213 16. programmable i/o ports _______________________ 216 16.1 port pi direction register (pdi register, i = 1, 6 to 10)........................................... 216 16.2 port pi register (pi register, i = 1, 6 to 10) ............................................................ 216 16.3 pull-up control register 0 to pull-up control register 2 (pur0 to pur2 registers) ... 216 16.4 port control register ............................................................................................... 217 16.5 pin assignment control register (pacr) ................................................................. 217 16.6 digital debounce function ....................................................................................... 217 17. flash memory version_________________________ 230 17.1 flash memory performance .................................................................................... 230 17.1.1 boot mode ....................................................................................................... 231
a-5 17.2 memory map ........................................................................................................... 232 17.3 functions to prevent flash memory from rewriting............................................... 235 17.3.1 rom code protect function ............................................................................ 235 17.3.2 id code check function .................................................................................. 235 17.4 cpu rewrite mode ................................................................................................. 237 17.4.1 ew0 mode ....................................................................................................... 238 17.4.2 ew1 mode ....................................................................................................... 238 17.5 register description ................................................................................................ 239 17.5.1 flash memory control register 0 (fmr0) ......................................................... 239 17.5.2 flash memory control register 1 (fmr1) ......................................................... 240 17.5.3 flash memory control register 4 (fmr4) ......................................................... 240 17.6 precautions in cpu rewrite mode .......................................................................... 245 17.6.1 operation speed .............................................................................................. 245 17.6.2 prohibited instructions ..................................................................................... 245 17.6.3 interrupts .......................................................................................................... 245 17.6.4 how to access ................................................................................................. 245 17.6.5 writing in the user rom space ....................................................................... 245 17.6.6 dma transfer ................................................................................................... 246 17.6.7 writing command and data ............................................................................. 246 17.6.8 wait mode ........................................................................................................ 246 17.6.9 stop mode ........................................................................................................ 246 17.6.10 low power consumption mode and on-chip oscillator-low power consumption mode ... 246 17.7 software commands ............................................................................................... 247 17.7.1 read array command (ff 16 ) .......................................................................... 247 17.7.2 read status register command (70 16 )........................................................... 247 17.7.3 clear status register command (50 16 )........................................................... 248 17.7.4 program command (40 16 ) ............................................................................... 248 17.7.5 block erase ...................................................................................................... 249 17.8 status register ........................................................................................................ 251 17.8.1 sequence status (sr7 and fmr00 bits ) ....................................................... 251 17.8.2 erase status (sr5 and fmr07 bits) ............................................................... 251 17.8.3 program status (sr4 and fmr06 bits) ........................................................... 251 17.8.4 full status check ............................................................................................. 252 17.9 standard serial i/o mode ........................................................................................ 254 17.9.1 id code check function .................................................................................. 254 17.9.2 example of circuit application in standard serial i/o mode ............................ 258 17.10 parallel i/o mode .................................................................................................. 260 17.10.1 rom code protect function .......................................................................... 260
a-6 18. electrical characteristics _______________________ 261 18.1. m16c/26a, m16c/26b (normal version) ................................................................ 261 18.2. m16c/26t (t version) ............................................................................................ 280 19. usage notes ________________________________ 299 19.1 sfr ....................................................................................................................... .. 299 19.1.1 precaution for 48-pin package ......................................................................... 299 19.1.2 precaution for 42-pin package ......................................................................... 299 19.1.3 register setting ............................................................................................... 299 19.2 pll frequency synthesizer .................................................................................... 300 19.3 power control ......................................................................................................... 301 19.4 protect ................................................................................................................... .. 303 19.5 interrupts ................................................................................................................ . 304 19.5.1 reading address 00000 16 .................................................................................................... 304 19.5.2 setting the sp .................................................................................................. 304 _______ 19.5.3 the nmi interrupt ............................................................................................. 304 19.5.4 changing the interrupt generation factor ....................................................... 304 ______ 19.5.5 int interrupt ..................................................................................................... 305 19.5.6 rewrite the interrupt control register ............................................................. 306 19.5.7 watchdog timer interrupt................................................................................. 306 19.6 dmac ...................................................................................................................... 307 19.6.1 write to dmae bit in dmicon register .......................................................... 307 19.7 timer ..................................................................................................................... .. 308 19.7.1 timer a ............................................................................................................. 308 19.7.2 timer b ............................................................................................................. 311 19.7.3 three-phase motor control timer function ..................................................... 312 19.8 serial i/o ................................................................................................................ . 313 19.8.1 clock-synchronous serial i/o .......................................................................... 313 19.8.2 serial i/o (uart mode) ................................................................................... 314 19.9 a/d converter .......................................................................................................... 315 19.10 programmable i/o ports ....................................................................................... 317 19.11 electric characteristic differences between mask rom and flash memory version microcomputers .................. 318 19.12 mask rom version ............................................................................................... 319 19.12.1 internal rom area ......................................................................................... 319 19.12.2 reserve bit ..................................................................................................... 319
a-7 19.13 flash memory version .......................................................................................... 320 19.13.1 functions to inhibit rewriting flash memory ................................................. 320 19.13.2 stop mode ...................................................................................................... 320 19.13.3 wait mode ...................................................................................................... 320 19.13.4 low power dissipation mode, on-chip oscillator low power dissipation mode... 320 19.13.5 writing command and data ............................................................................ 320 19.13.6 program command ........................................................................................ 320 19.13.7 operation speed ............................................................................................ 320 19.13.8 instructions prohibited in ew0 mode ............................................................. 320 19.13.9 interrupts ........................................................................................................ 321 19.13.10 how to access .............................................................................................. 321 19.13.11 writing in the user rom area ....................................................................... 321 19.13.12 dma transfer ................................................................................................ 321 19.13.13 regarding programming/erasure times and execution time ..................... 321 19.13.14 definition of programming/erasure times ................................................... 322 19.13.15 flash memory version electrical characteristics 10,000 e/w cycle product .. 322 19.13.16 boot mode .................................................................................................... 322 19.14 noise .................................................................................................................... . 323 19.15 instruction for a device use .................................................................................. 324 appendix 1. package dimensions___________________ 325 appendix 2. functional difference __________________ 326 appendix 2.1 differences between m16c/26a, m16c/26b, and m16c/26t ................... 326 appendix 2.2 differences between m16c/26a group and m16c/26 group ................... 327 register index __________________________________ 328
b-1 quick reference by address 0000 16 0001 16 0002 16 0003 16 0004 16 0005 16 0006 16 0007 16 0008 16 0009 16 000a 16 000b 16 000c 16 000d 16 000e 16 000f 16 0010 16 0011 16 0012 16 0013 16 0014 16 0015 16 0016 16 0017 16 0018 16 0019 16 001a 16 001b 16 001c 16 001d 16 001e 16 001f 16 0020 16 0021 16 0022 16 0023 16 0024 16 0025 16 0026 16 0027 16 0028 16 0029 16 002a 16 002b 16 002c 16 002d 16 002e 16 002f 16 0030 16 0031 16 0032 16 0033 16 0034 16 0035 16 0036 16 0037 16 0038 16 0039 16 003a 16 003b 16 003c 16 003d 16 003e 16 003f 16 address note: 1. the blank areas are reserved and cannot be accessed by users. register symbol page 0040 16 0041 16 0042 16 0043 16 0044 16 0045 16 0046 16 0047 16 0048 16 0049 16 004a 16 004b 16 004c 16 004d 16 004e 16 004f 16 0050 16 0051 16 0052 16 0053 16 0054 16 0055 16 0056 16 0057 16 0058 16 0059 16 005a 16 005b 16 005c 16 005d 16 005e 16 005f 16 0060 16 0061 16 0062 16 0063 16 0064 16 0065 16 0066 16 0067 16 0068 16 0069 16 006a 16 006b 16 006c 16 006d 16 006e 16 006f 16 0070 16 0071 16 0072 16 0073 16 0074 16 0075 16 0076 16 0077 16 0078 16 0079 16 007a 16 007b 16 007c 16 007d 16 007e 16 007f 16 watchdog timer start register wdts watchdog timer control register wdc processor mode register 0 pm0 system clock control register 0 cm0 system clock control register 1 cm1 address match interrupt enable register aier protect register prcr processor mode register 1 pm1 oscillation stop detection register cm2 pll control register 0 plc0 processor mode register 2 pm2 address match interrupt register 0 rmad0 address match interrupt register 1 rmad1 dma0 control register dm0con dma0 transfer counter tcr0 dma1 control register dm1con dma1 source pointer sar1 dma1 destination pointer dar1 dma0 destination pointer dar0 dma0 source pointer sar0 voltage detection register 1 vcr1 voltage detection register 2 vcr2 voltage down detection interrupt register d4int uart0 transmit interrupt control register s0tic uart0 receive interrupt control register s0ric uart1 transmit interrupt control register s1tic uart1 receive interrupt control register s1ric dma1 transfer counter tcr1 int3 interrupt control register int3ic int5 interrupt control register int5ic int4 interrupt control register int4ic uart2 bus collision detection interrupt control register bcnic dma0 interrupt control register dm0ic dma1 interrupt control register dm1ic key input interrupt control register kupic a/d conversion interrupt control register adic uart2 transmit interrupt control register s2tic uart2 receive interrupt control register s2ric timer a0 interrupt control register ta0ic timer a1 interrupt control register ta1ic timer a2 interrupt control register ta2ic timer a3 interrupt control register ta3ic timer a4 interrupt control register ta4ic timer b0 interrupt control register tb0ic timer b2 interrupt control register tb2ic int0 interrupt control register int0ic int1 interrupt control register int1ic int2 interrupt control register int2ic timer b1 interrupt control register tb1ic 35 35 40 41 79 60 42 81 81 79 79 30 30 44 36, 43 30 81 86 86 85 86 86 86 85 67 67 67 67 67 67 67 67 67 67 67 67 67 67 67 67 67 67 67 67 67 67 67 67 67 address register symbol page
b-2 quick reference by address flash memory control register 0 fmr0 flash memory control register 1 fmr1 flash memory control register 4 fmr4 notes: 1. the blank areas are reserved and cannot be accessed by users. 2. this register is included in the flash memory version. 0080 16 0081 16 0082 16 0083 16 0084 16 0085 16 0086 16 01b0 16 01b1 16 01b2 16 01b3 16 01b4 16 01b5 16 01b6 16 01b7 16 01b8 16 01b9 16 01ba 16 01bb 16 01bc 16 01bd 16 01be 16 01bf 16 0250 16 0251 16 0252 16 0253 16 0254 16 0255 16 0256 16 0257 16 0258 16 0259 16 025a 16 025b 16 025c 16 025d 16 025e 16 025f 16 02e0 16 02e1 16 02e2 16 02e3 16 02e4 16 02e5 16 02e6 16 02e7 16 02e8 16 02e9 16 033d 16 033e 16 033f 16 peripheral clock select register pclkr 241 241 43 (2) (2) address register symbol page (2) 242 pin assignment control register pacr on-chip oscillator control register rocr 139, 226 41 p1 7 digital debounce register p17ddr nmi digital debounce register nddr 227 227 three phase protect control register tprc 0340 16 0341 16 0342 16 0343 16 0344 16 0345 16 0346 16 0347 16 0348 16 0349 16 034a 16 034b 16 034c 16 034d 16 034e 16 034f 16 0350 16 0351 16 0352 16 0353 16 0354 16 0355 16 0356 16 0357 16 0358 16 0359 16 035a 16 035b 16 035c 16 035d 16 035e 16 035f 16 0360 16 0361 16 0362 16 0363 16 0364 16 0365 16 0366 16 0367 16 0368 16 0369 16 036a 16 036b 16 036c 16 036d 16 036e 16 036f 16 0370 16 0371 16 0372 16 0373 16 0374 16 0375 16 0376 16 0377 16 0378 16 0379 16 037a 16 037b 16 037c 16 037d 16 037e 16 037f 16 timer a1-1 register ta11 timer a2-1 register ta21 dead time timer dtt timer b2 interrupt occurrence frequency set counter ictb2 three-phase pwm control register 0 invc0 three-phase pwm control register 1 invc1 three-phase output buffer register 0 idb0 three-phase output buffer register 1 idb1 interrupt request cause select register ifsr uart2 special mode register u2smr uart2 receive buffer register u2rb uart2 transmit buffer register u2tb uart2 transmit/receive control register 0 u2c0 uart2 transmit/receive mode register u2mr uart2 transmit/receive control register 1 u2c1 uart2 bit rate generator u2brg timer a4-1 register ta41 uart2 special mode register 2 u2smr2 uart2 special mode register 3 u2smr3 uart2 special mode register 4 u2smr4 122 122 122 119 120 121 121 121 122 141 141 140 140 137 136 136 138 139 136 68, 76 address register symbol page position-data-retain function contol register pdrf 129 port function contol register pfcr interrupt request cause select register 2 ifsr2a 68 131 131
b-3 quick reference by address note: 1. the blank areas are reserved and cannot be accessed by users. 0380 16 0381 16 0382 16 0383 16 0384 16 0385 16 0386 16 0387 16 0388 16 0389 16 038a 16 038b 16 038c 16 038d 16 038e 16 038f 16 0390 16 0391 16 0392 16 0393 16 0394 16 0395 16 0396 16 0397 16 0398 16 0399 16 039a 16 039b 16 039c 16 039d 16 039e 16 039f 16 03a0 16 03a1 16 03a2 16 03a3 16 03a4 16 03a5 16 03a6 16 03a7 16 03a8 16 03a9 16 03aa 16 03ab 16 03ac 16 03ad 16 03ae 16 03af 16 03b0 16 03b1 16 03b2 16 03b3 16 03b4 16 03b5 16 03b6 16 03b7 16 03b8 16 03b9 16 03ba 16 03bb 16 03bc 16 03bd 16 03be 16 03bf 16 count start flag tabsr trigger select register trgsr timer a0 register ta0 timer a1 register ta1 timer a2 register ta2 timer b0 register tb0 timer b1 register tb1 timer b2 register tb2 one-shot start flag onsf timer a0 mode register ta0mr timer a1 mode register ta1mr timer a2 mode register ta2mr timer b0 mode register tb0mr timer b1 mode register tb1mr timer b2 mode register tb2mr up-down flag udf timer a3 register ta3 timer a4 register ta4 timer a3 mode register ta3mr timer a4 mode register ta4mr clock prescaler reset flag cpsrf uart0 transmit/receive mode register u0mr uart0 transmit buffer register u0tb uart0 receive buffer register u0rb uart1 transmit/receive mode register u1mr uart1 transmit buffer register u1tb uart1 receive buffer register u1rb uart0 bit rate generator u0brg uart0 transmit/receive control register 0 u0c0 uart0 transmit/receive control register 1 u0c1 uart1 bit rate generator u1brg uart1 transmit/receive control register 0 u1c0 uart1 transmit/receive control register 1 u1c1 dma1 request cause select register dm1sl dma0 request cause select register dm0sl uart transmit/receive control register 2 ucon timer b2 special mode register tb2sc 95, 110, 124 96 r0) 96, 124 95 110 110 110, 124 94 94, 125 94 109 109 123, 185 137 136 136 138 139 136 137 136 136 138 139 136 138 84 85 95 95, 122 95, 122 95 95, 122 94, 125 94, 125 109, 125 address register symbol page crc snoop address register crcsar crc mode register crcmr crc data register crcd crc input register crcin 03c0 16 03c1 16 03c2 16 03c3 16 03c4 16 03c5 16 03c6 16 03c7 16 03c8 16 03c9 16 03ca 16 03cb 16 03cc 16 03cd 16 03ce 16 03cf 16 03d0 16 03d1 16 03d2 16 03d3 16 03d4 16 03d5 16 03d6 16 03d7 16 03d8 16 03d9 16 03da 16 03db 16 03dc 16 03dd 16 03de 16 03df 16 03e0 16 03e1 16 03e2 16 03e3 16 03e4 16 03e5 16 03e6 16 03e7 16 03e8 16 03e9 16 03ea 16 03eb 16 03ec 16 03ed 16 03ee 16 03ef 16 03f0 16 03f1 16 03f2 16 03f3 16 03f4 16 03f5 16 03f6 16 03f7 16 03f8 16 03f9 16 03fa 16 03fb 16 03fc 16 03fd 16 03fe 16 03ff 16 a/d control register 1 adcon1 port p9 register p9 pull-up control register 0 pur0 port control register pcr a/d register 7 ad7 a/d register 0 ad0 a/d register 1 ad1 a/d register 2 ad2 a/d register 3 ad3 a/d register 4 ad4 a/d register 5 ad5 a/d register 6 ad6 a/d control register 0 adcon0 a/d control register 2 adcon2 port p1 register p1 port p1 direction register pd1 port p6 register p6 port p6 direction register pd6 port p7 register p7 port p7 direction register pd7 port p8 register p8 port p8 direction register pd8 port p9 direction register pd9 port p10 register p10 port p10 direction register pd10 pull-up control register 1 pur1 pull-up control register 2 pur2 184 184 184 184 184 184 184 184 182 182 182 224 223 224 224 223 223 224 224 223 223 224 223 225 225 225 226 address register symbol page a/d convert status register 0 adstat0 184 a/d trigger control register adtrgcon 183 214 214 214 214
single-chip 16-bit cmos microcomputer page 1 9 2 3 f o 7 0 0 2 , 5 1 . b e f 0 0 . 2 . v e r 0 0 2 0 - 2 0 2 0 b 9 0 j e r ) t 6 2 / c 6 1 m , b 6 2 / c 6 1 m , a 6 2 / c 6 1 m ( p u o r g a 6 2 / c 6 1 m 1. overview the m16c/26a group (m16c/26a, m16c/26b, m16c/26t) is a single-chip control mcu, fabricated using high-performance silicon gate cmos technology, embedding the m16c/60 series cpu core. the m16c/ 26a group (m16c/26a, m16c/26b, m16c/26t) is housed in 42-pin and 48-pin plastic molded packages. this mcu combines advanced instruction manipulation capabilities to process complex instructions by less bytes and execute instructions at higher speed. the m16c/26a group (m16c/26a, m16c/26b, m16c/ 26t) has a multiplier and dmac adequate for office automation, communication devices and industrial equipment, and other high-speed processing applications. the m16c/26a and m16c/26b have normal version. the m16c/26t has t version and v version. 1.1 applications audio, cameras, office/communications/portable/ equipment, air-conditioning equipment, home appli- ances, etc.
1. overview page 2 9 2 3 f o 7 0 0 2 , 5 1 . b e f 0 0 . 2 . v e r 0 0 2 0 - 2 0 2 0 b 9 0 j e r ) t 6 2 / c 6 1 m , b 6 2 / c 6 1 m , a 6 2 / c 6 1 m ( p u o r g a 6 2 / c 6 1 m item specification cpu basic instructions 91 instructions minimun instruction 41.7 ns (f(bclk) = 24mh z (3) , v cc = 4.2 to 5.5 v) (m16c/26b) execution time 50 ns (f(bclk) = 20mh z , v cc = 3.0 to 5.5 v) (m16c/26a, m16c/26b, m16c/26t(t-ver.)) 100 ns (f(bclk) = 10mh z , v cc = 2.7 to 5.5 v) (m16c/26a , m16c/26b) 50 ns (f(bclk) = 20mh z , v cc = 4.2 to 5.5 v -40 to 105 c) (m16c/26t(v-ver.)) 62.5 ns (f(bclk) = 16mh z , v cc = 4.2 to 5.5 v -40 to 125 c) (m16c/26t(v-ver.)) operating mode single-chip mode address space 1 mbyte memory capacity rom/ram: see 1.4 product information peripheral i/o ports 39 i/o pins function multifunction timers timera:16 bits x 5 channels, timerb:16 bits x 3 channels three-phase motor control timer serial i/o 2 channels (uart, clock synchronous serial i/o) 1 channel (uart, clock synchronous, i 2 c bus, or iebus (1) ) a/d converter 10 bit a/d converter : 1 circuit, 12 channels dmac 2 channels crc calcuration circuit 1 circuit (crc-ccitt and crc-16) with msb/lsb selectable watchdog timer 15 bits x 1 channel (with prescaler) interrupts 20 internal and 8 external sources, 4 software sources, interrupt priority level: 7 clock generation circuit 4 circuits main clock oscillation circuit(*), sub-clock oscillation circuit(*) on-chip oscillator, pll frequency synthesizer (*)equipped with a built-in feedback resister. oscillation stop detection main clock oscillation stop, re-oscillation detection function voltage detection circuit on-chip (m16c/26a, m16c/26b), not on-chip (m16c/26t) electrical power supply voltage v cc = 4.2 to 5.5 v (f(bclk) = 24 mh z ) (3) (m16c/26b) characteristics v cc = 3.0 to 5.5 v (f(bclk) = 20 mh z ) (m16c/26a, m16c/26b) v cc = 2.7 to 5.5 v (f(bclk) = 10 mh z ) v cc = 3.0 to 5.5 v (m16c/26t(t-ver.)) v cc = 4.2 to 5.5 v (m16c/26t(v-ver.)) power consumption 20 ma (vcc = 5 v, f(bclk) = 24 mhz) (m16c/26b) 16 ma (vcc = 5 v, f(bclk) = 20 mhz) 25 a (f(xcin) = 32 khz on ram) 3 a (vcc = 3 v, f(xcin) = 32 khz, in wait mode) 0.7 a (vcc = 3 v, in stop mode) flash memory programming /erasure 2.7 to 5.5 v (m16c/26a, m16c/26b) version voltage 3.0 to 5.5 v (m16c/26t(t-ver.)) 4.2 to 5.5 v (m16c/26t(v-ver.)) programming /erasure 100 times (all area) or 1,000 times (block 0 to 3) endurance / 10,000 times (block a, block b) (2) operating ambient temperature -20 to 85 c / -40 to 85 c (2) (m16c/26a , m16c/26b) -40 to 85 c (m16c/26t(t-ver.)) -40 to 105 c / -40 to 125 c (m16c/26t(v-ver.)) package 48-pin plastic molded qfp notes: 1. iebus is a trademark of nec electronics corporation. 2. see tables 1.7 to 1.10 product code for the program and erase endurance, and operating ambient temperature. 3. the pll frequency synthesizer is used to run the m16c/26b at f(bclk) = 24 mhz. table 1.1. m16c/26a group(m16c/26a, m16c/26b, m16c/26t) performance (48-pin package) 1.2 performance outline table 1.1 and 1.2 outline performance overview of the m16c/26a group (m16c/26a, m16c/26b, m16c/ 26t).
1. overview page 3 9 2 3 f o 7 0 0 2 , 5 1 . b e f 0 0 . 2 . v e r 0 0 2 0 - 2 0 2 0 b 9 0 j e r ) t 6 2 / c 6 1 m , b 6 2 / c 6 1 m , a 6 2 / c 6 1 m ( p u o r g a 6 2 / c 6 1 m table 1.2. performance outline of m16c/26a group (m16c/26a, m16c/26b) (42-pin package) item performance cpu basic instructions 91 instructions minimun instruction 41.7 ns (f(bclk) = 24 mhz (3) , vcc = 4.2 to 5.5 v (m16c/26b) execution time 50 ns (f(bclk) = 20 mh z , v cc = 3.0 to 5.5 v) (m16c/26a, m16c/26b) 100 ns (f(bclk) = 10 mh z , v cc = 2.7 to 5.5 v) (m16c/26a, m16c/26b) operation mode single-chip mode address space 1m byte memory capacity rom/ram: see 1.4 product information peripheral port 33 i/o pins function multifunction timer timer a: 16 bits x 5 channels, timer b: 16 bits x 3 channels three-phase motor control timer serial i/o 1 channel (uart, clock synchronous serial i/o) 1 channel (uart, clock synchronous, i 2 c bus, or iebus (1) ) a/d converter 10 bit a/d converter: 1 circuit, 10 channels dmac 2 channels crc calcuration circuit 1 circuits (crc-ccitt and crc-16) with msb/lsb selectable watchdog timer 15 bits x 1 channel (with prescaler) interrupt 18 internal and 8 external sources, 4 software sources, interrupt priority level: 7 clock generation circuit 4 circuits main clock(*), sub-clock(*) on-chip oscillator, pll frequency synthesizer (*)equipped with a built-in feedback resister. oscillation stop detection main clock oscillation stop, re-oscillation detection function voltage detection circuit on-chip electrical supply voltage v cc = 4.2 to 5.5 v (f(bclk) = 24 mh z ) (3) (m16c/26b) characteristics v cc = 3.0 to 5.5 v (f(bclk) = 20 mh z ) (m16c/26a, m16c/26b) v cc = 2.7 to 5.5 v (f(bclk) = 10 mh z ) power consumption 20 ma (vcc = 5 v, f(bclk) = 24 mhz) (m16c/26b) 16 ma (vcc = 5 v, f(bclk) = 20 mhz) 25 a (f(xcin) = 32 khz on ram) 3 a (vcc = 3 v, f(xcin) = 32 khz, in wait mode) 0.7 a (vcc = 3 v, in stop mode) flash memory programming/erasure 2.7 to 5.5 v voltage programming/erasure 100 times (all area) or 1,000 times (block 0 to 3) endurance / 10,000 times (block a, block b) (2) operating ambient temperature -20 to 85 c / -40 to 85 c (2) package 42-pin plastic molded ssop notes: 1. iebus is a trademark of nec electronics corporation. 2. see tables 1.7 and 1.8 product code for the program and erase endurance, and operating ambient tempera- ture. 3. the pll frequency synthesizer is used to run the m16c/26b at f(bclk) = 24 mhz.
1. overview page 4 9 2 3 f o 7 0 0 2 , 5 1 . b e f 0 0 . 2 . v e r 0 0 2 0 - 2 0 2 0 b 9 0 j e r ) t 6 2 / c 6 1 m , b 6 2 / c 6 1 m , a 6 2 / c 6 1 m ( p u o r g a 6 2 / c 6 1 m 1.3 block diagram figure 1.1 and 1.2 show block diagrams of the m16c/26a group (m16c/26a, m16c/26b, m16c/26t) 48- pin package and 42-pin package. figure 1.1 block diagram(48-pin package) timer (16-bit) output (timer a): 5channels input (timer b): 3 channels peripheral functions watchdog timer (15 bits) dmac (2 channels) uart or clock synchronous serial i/o (8 bits x 3 channels) clock generation circuit xin-xout xcin-xcout on-chip oscillator pll frequency synthesizer m16c/60 series cpu core port p1 3 port p10 8 memory rom (1) ram (2) notes: 1: rom size depends on the mcu type. 2: ram size depends on the mcu type. r0l r0h r1h r1l r2 r3 sb flg usp isp intb pc multiplier three-phase motor control circuit a0 a1 fb 8 port p6 8 port p7 8 port p8 4 port p9 crc calculation circuit (ccitt, crc-16 ) 10-bit a/d converter 12 channels
1. overview page 5 9 2 3 f o 7 0 0 2 , 5 1 . b e f 0 0 . 2 . v e r 0 0 2 0 - 2 0 2 0 b 9 0 j e r ) t 6 2 / c 6 1 m , b 6 2 / c 6 1 m , a 6 2 / c 6 1 m ( p u o r g a 6 2 / c 6 1 m figure 1.2 block diagram( 42-pin package) timer (16-bit) output (timer a): 5channels input (timer b): 3 channels peripheral functions watchdog timer (15 bits) dmac (2 channels) uart or clock synchronous serial i/o (8 bits x 2 channels) clock generation circuit xin-xout xcin-xcout on-chip oscillator pll frequency synthesizer m16c/60 series cpu core port p1 3 port p10 8 memory rom (1) ram (2) notes: 1: rom size depends on the mcu type. 2: ram size depends on the mcu type. r0l r0h r1h r1l r2 r3 sb flg usp isp intb pc multiplier three-phase motor control circuit a0 a1 fb 4 port p6 8 port p7 8 port p8 2 port p9 crc calculation circuit (ccitt, crc-16 ) 10-bit a/d converter 10 channels
1. overview page 6 9 2 3 f o 7 0 0 2 , 5 1 . b e f 0 0 . 2 . v e r 0 0 2 0 - 2 0 2 0 b 9 0 j e r ) t 6 2 / c 6 1 m , b 6 2 / c 6 1 m , a 6 2 / c 6 1 m ( p u o r g a 6 2 / c 6 1 m 1.4 product list tables 1.3 to 1.6 lists product information, figure 1.3 shows a product numbering system, table 1.7 lists the product code, and figure 1.4 shows the marking. table 1.3 m16c/26a current as of feb., 2007 r e b m u n e p y t m o r y t i c a p a c m a r y t i c a p a c e p y t e g a k c a ps k r a m e re d o c t c u d o r p p g a 3 f 0 6 2 0 3 m) n (k 4 + k 4 2k 1 ) a - q 6 p 8 4 ( a - b k 8 4 0 0 p q l p h s a l f y r o m e m 9 u , 7 u , 5 u , 3 u p g a 6 f 0 6 2 0 3 m) n (k 4 + k 8 4k 2 p g a 8 f 0 6 2 0 3 m) n (k 4 + k 4 6k 2 p f a 3 f 3 6 2 0 3 m) n (k 4 + k 4 2k 1 ) r 2 p 2 4 ( b - a g 2 4 0 0 p s r p9 u , 5 u p f a 6 f 3 6 2 0 3 m) n (k 4 + k 8 4k 2 p f a 8 f 3 6 2 0 3 m) n (k 4 + k 4 6k 2 p g x x x - a 3 m 0 6 2 0 3 m) n (k 4 2k 1 ) a - q 6 p 8 4 ( a - b k 8 4 0 0 p q l p m o r k s a m 5 u , 3 u p g x x x - a 6 m 0 6 2 0 3 m) n (k 8 4k 2 p g x x x - a 8 m 0 6 2 0 3 m) n (k 4 6k 2 p f x x x - a 3 m 3 6 2 0 3 m) n (k 4 2k 1 ) r 2 p 2 4 ( b - a g 2 4 0 0 p s r p5 u p f x x x - a 6 m 3 6 2 0 3 m) n (k 8 4k 2 p f x x x - a 8 m 3 6 2 0 3 m) n (k 4 6k 2 w e n : ) n ( r e b m u n e p y t m o r y t i c a p a c m a r y t i c a p a c e p y t e g a k c a ps k r a m e re d o c t c u d o r p p g b 8 f 0 6 2 0 3 m) n (k 4 + k 4 6k 2) a - q 6 p 8 4 ( a - b k 8 4 0 0 p q l p h s a l f y r o m e m 7 u p f b 8 f 3 6 2 0 3 m) n (k 4 + k 4 6k 2) r 2 p 2 4 ( b - a g 2 4 0 0 p s r p9 u w e n : ) n ( r e b m u n e p y t m o r y t i c a p a c m a r y t i c a p a c e p y t e g a k c a ps k r a m e re d o c t c u d o r p p g t 3 f 0 6 2 0 3 mk 4 + k 4 2k 1 ) a - q 6 p 8 4 ( a - b k 8 4 0 0 p q l p h s a l f y r o m e m 7 u , 3 u p g t 6 f 0 6 2 0 3 mk 4 + k 8 4k 2 p g t 8 f 0 6 2 0 3 mk 4 + k 4 6k 2 : e t o n . y l n o n o i s r e v y r o m e m h s a l f n i e l b a l i a v a . 1 table 1.4 m16c/26b current as of feb., 2007 table 1.5 m16c/26t t-ver. current as of feb., 2007 table 1.6 m16c/26t v-ver. current as of feb., 2007 r e b m u n e p y t m o r y t i c a p a c m a r y t i c a p a c e g a k c a ps k r a m e re d o c t c u d o r p p g v 8 f 0 6 2 0 3 mk 4 + k 4 6k 2) a - q 6 p 8 4 ( a - b k 8 4 0 0 p q l p h s a l f y r o m e m 7 u , 3 u : e t o n . y l n o n o i s r e v y r o m e m h s a l f n i e l b a l i a v a . 1
1. overview page 7 9 2 3 f o 7 0 0 2 , 5 1 . b e f 0 0 . 2 . v e r 0 0 2 0 - 2 0 2 0 b 9 0 j e r ) t 6 2 / c 6 1 m , b 6 2 / c 6 1 m , a 6 2 / c 6 1 m ( p u o r g a 6 2 / c 6 1 m figure 1.3 product numbering system package type: gp: plqp0048kb-a (48p6q) (m16c/26a, m16c/26b, m16c/26t) fp: prsp0042ga-b (42p2r) (m16c/26a, m16c/26b) version: a : m16c/26a b : m16c/26b t : m16c/26t t-ver. v : m16c/26t v-ver. rom / ram capacity: 3: (24k+4k) bytes (1) / 1k bytes 6: (48k+4k) bytes (1) / 2k bytes 8: (64k+4k) bytes (1) / 2k bytes note: 1. only flash memory version exists in "+4k bytes" memory type: m: mask rom version f: flash memory version type no. m 3 0 2 6 0 m 8 a - xxx g p - u3 m16c/26a group m16c family pin count (the value itself has no specific meaning) product code: see tables 1.7 to 1.10 rom number: rom number is omitted in flash memory version
1. overview page 8 9 2 3 f o 7 0 0 2 , 5 1 . b e f 0 0 . 2 . v e r 0 0 2 0 - 2 0 2 0 b 9 0 j e r ) t 6 2 / c 6 1 m , b 6 2 / c 6 1 m , a 6 2 / c 6 1 m ( p u o r g a 6 2 / c 6 1 m t c u d o r p e d o c e g a k c a p m o r l a n r e t n i ) 3 o t 0 s k c o l b : e c a p s m a r g o r p ( m o r l a n r e t n i ) b d n a a s k c o l b : e c a p s a t a d ( t n e i b m a g n i t a r e p o e r u t a r e p m e t d n a m a r g o r p e s a r e e c n a r u d n e e r u t a r e p m e t e g n a r d n a m a r g o r p e s a r e e c n a r u d n e e r u t a r e p m e t e g n a r 3 u e e r f d a e l 0 0 1 c o 0 6 o t 0 0 0 1c o 0 6 o t 0 c o 5 8 o t 0 4 - 5 u c o 5 8 o t 0 2 - 7 u 0 0 0 , 10 0 0 , 0 1 c o 5 8 o t 0 4 -c o 5 8 o t 0 4 - 9 u c o 5 8 o t 0 2 -c o 5 8 o t 0 2 - table 1.7 product code (flash memory version) - m16c/26a, m16c/26b table 1.8 product code (mask rom version - m16c/26a) t c u d o r p e d o c e g a k c a p t n e i b m a g n i t a r e p o e r u t a r e p m e t 3 u e e r f d a e l c o 0 4 -o tc o 5 8 5 uc o 0 2 -o tc o 5 8 t c u d o r p e d o c e g a k c a p m o r l a n r e t n i ) 3 o t 0 s k c o l b : e c a p s m a r g o r p ( m o r l a n r e t n i ) b d n a a s k c o l b : e c a p s a t a d ( t n e i b m a g n i t a r e p o e r u t a r e m e t g n i m m a r g o r p e r u s a r e d n a e c n a r u d n e e r u t a r e p m e t e g n a r g n i m m a r g o r p e r u s a r e d n a e c n a r u d n e e r u t a r e p m e t e g n a r 3 u e e r f d a e l 0 0 1 c o 0 6 o t c o 0 0 0 1 c o 5 8 o t c o 0 4 -c o 5 8 o t c o 0 4 - 7 u0 0 0 , 10 0 0 , 0 1 note: 1. the lead contained products, d3, d5, d7, and d9 are put together with u3, u5, u7, and u9 respectively. lead-free products can be mounted by both conventional sn-pb paste and lead-free paste (sn-ag-cu plating). t c u d o r p e d o c e g a k c a p m o r l a n r e t n i ) 3 o t 0 s k c o l b : e c a p s m a r g o r p ( m o r l a n r e t n i ) b d n a a s k c o l b : e c a p s a t a d ( t n e i b m a g n i t a r e p o e r u t a r e m e t g n i m m a r g o r p e r u s a r e d n a e c n a r u d n e e r u t a r e p m e t e g n a r g n i m m a r g o r p e r u s a r e d n a e c n a r u d n e e r u t a r e p m e t e g n a r 3 u e e r f d a e l 0 0 1 c o 0 6 o t c o 0 0 0 1 c o 5 2 1 o t c o 0 4 -c o 5 2 1 o t c o 0 4 - 7 u0 0 0 , 10 0 0 , 0 1 table 1.9 product code (flash memory version) - m16c/26t t-ver. table 1.10 product code (flash memory version) - m16c/26t v-ver.
1. overview page 9 9 2 3 f o 7 0 0 2 , 5 1 . b e f 0 0 . 2 . v e r 0 0 2 0 - 2 0 2 0 b 9 0 j e r ) t 6 2 / c 6 1 m , b 6 2 / c 6 1 m , a 6 2 / c 6 1 m ( p u o r g a 6 2 / c 6 1 m figure 1.4 marking diagram (m16c/26a , m16c/26b) 0260f8a a u3 xxxxx (1) flash memory version, plqp0048kb-a (48p6q), m16c/26a, m16c/26b m30263f8afp a u3 xxxxxxx (2) flash memory version, prsp0042ga-b (42p2r), m16c/26a, m16c/26b 0260m8a 001a u3 xxxxx (3) mask rom version, plqp0048kb-a (48p6q), m16c/26a m30263m8a-001fp a u3 xxxxxxx (4) mask rom version, prsp0042ga-b (42p2r), m16c/26a product name : indicates m30260f8agp chip version and product code: a : indicates chip version the first edition is shown to be blank and continues with a and b. u3 : indicates product code (see table 1.7 product code ) date code (5 digits) ? indicates manufacturing management code product name : indicates m30260m8agp rom number, chip version and product code: 001: indicates rom number a : indicates chip version the first edition is shown to be blank and continues with a and b. u3 : indicates product code (see table 1.8 product code ) date code (5 digits) ? indicates manufacturing management code product name : indicates m30263f8afp chip version and product code: a : indicates chip version the first edition is shown to be blank and continues with a and b. u3 : indicates product code (see table 1.7 product code ) date code (7 digits) ? indicates manufacturing management code product name and rom number m30263m8a and fp are indicated of produnct name 001 is indicated of rom number chip version and product code: a : indicates chip version the first edition is shown to be blank and continues with a and b. u3 : indicates product code (see table 1.8 product code ) date code (7 digits) ? indicates manufacturing management code
1. overview page 10 9 2 3 f o 7 0 0 2 , 5 1 . b e f 0 0 . 2 . v e r 0 0 2 0 - 2 0 2 0 b 9 0 j e r ) t 6 2 / c 6 1 m , b 6 2 / c 6 1 m , a 6 2 / c 6 1 m ( p u o r g a 6 2 / c 6 1 m 0260f8t a u3 xxxxx 0260f8v a u3 xxxxx (1) flash memory version, plqp0048kb-a (48p6q), m16c/26t t-ver. (2) flash memory version, plqp0048kb-a (48p6q), m16c/26t v-ver. product name : indicates m30260f8vgp chip version and product code: a : indicates chip version the first edition is shown to be blank and continues with a and b. u3 : indicates product code (see table 1.10 product code ) date code (5 digits) ? indicates manufacturing management code product name : indicates m30260f8tgp chip version and product code: a : indicates chip version the first edition is shown to be blank and continues with a and b. u3 : indicates product code (see table 1.9 product code ) date code (5 digits) ? indicates manufacturing management code figure 1.5 marking diagram (m16c/26t)
1. overview page 11 9 2 3 f o 7 0 0 2 , 5 1 . b e f 0 0 . 2 . v e r 0 0 2 0 - 2 0 2 0 b 9 0 j e r ) t 6 2 / c 6 1 m , b 6 2 / c 6 1 m , a 6 2 / c 6 1 m ( p u o r g a 6 2 / c 6 1 m 24 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 36 35 34 33 32 31 30 29 28 27 26 25 48 47 46 45 44 43 42 41 40 39 38 37 p9 2 /tb2 in /an 32 p9 1 /tb1 in /an 31 cnv ss p1 7 /int 5 /idu p1 6 /int 4 /idw p1 5 /int 3 /ad trg /idv p10 7 /an 7 /ki 3 p7 0 /txd 2 /ta 0out /sda 2 /cts 1 /rts 1 /cts 0 /clks 1 x out v ss x in p8 5 /nmi/sd v cc p6 7 /txd 1 p6 6 /rxd 1 p6 5 /clk 1 reset p7 1 /rxd 2 /ta0 in /scl 2 /clk 1 p7 2 /clk 2 /ta1 out /v/rxd 1 p7 3 /cts 2 /rts 2 /ta1 in /v/txd 1 p7 4 /ta2 out /w p7 5 /ta2 in /w p7 6 /ta3 out p7 7 /ta3 in p8 0 /ta4 out /u p8 1 /ta4 in /u p8 2 /int 0 p8 3 /int 1 p6 4 /cts 1 /rts 1 /cts 0 /clks 1 p6 3 /txd 0 p6 2 /rxd 0 p6 1 /clk 0 p6 0 /cts 0 /rts 0 p9 0 /tb0 in /an 30 /clk out p8 7 /x cin p8 6 /x cout p10 6 /an 6 /ki 2 p10 5 /an 5 /ki 1 p10 4 /an 4 /ki 0 p10 3 /an 3 p10 2 /an 2 p10 1 /an 1 av ss p10 0 /an 0 v ref av cc p9 3 /an 24 p8 4 /int 2 /zp note: 1. set pacr2 to pacr0 bit in the pacr register to "100 2 " before you input and output it after resetting to each pin. when the pacr register isn't set up, the input and output function of some of the p ins are disabled. package: plqp0048kb-a (48p6q) 1.5 pin assignments figures 1.6 and 1.7 show the pin assignments (top view). figure 1.6 pin assignment for 48-pin package (top view)
1. overview page 12 9 2 3 f o 7 0 0 2 , 5 1 . b e f 0 0 . 2 . v e r 0 0 2 0 - 2 0 2 0 b 9 0 j e r ) t 6 2 / c 6 1 m , b 6 2 / c 6 1 m , a 6 2 / c 6 1 m ( p u o r g a 6 2 / c 6 1 m table 1.11 pin characteristics for 48-pin package n i p . o n l o r t n o c n i p t r o p t p u r r e t n i n i p n i p r e m i tn i p t r a un i p g o l a n a 19 p 2 b t n i 2 3 n a 2 29 p 1 b t n i 1 3 n a 1 39 p 0 b t n i 0 k l c t u o 3 n a 0 4s s v n c 5x n i c 8 p 7 6x t u o c 8 p 6 7t e s e r 8x t u o 9s s v 0 1x n i 1 1c c v 2 18 p 5 i m nd s 3 18 p 4 t n i 2 p z 4 18 p 3 t n i 1 5 18 p 2 t n i 0 6 18 p 1 a t n i 4 u / 7 18 p 0 a t t u o 4 u / 8 17 p 7 a t n i 3 9 17 p 6 a t t u o 3 0 27 p 5 a t n i 2 w / 1 27 p 4 a t t u o 2 w / 2 27 p 3 a t n i 1 v /s t c 2 s t r / 2 t / x d 1 3 27 p 2 a t t u o 1 v /k l c 2 r / x d 1 4 27 p 1 a t n i 0 r x d 2 l c s / 2 k l c / 1 5 27 p 0 a t t u o 0 t x d 2 a d s / 2 s t r / 1 s t c / 1 s t c / 0 s k l c / 1 6 26 p 7 t x d 1 7 26 p 6 r x d 1 8 26 p 5 k l c 1 9 26 p 4 s t r 1 s t c / 1 s t c / 0 s k l c / 1 0 36 p 3 t x d 0 1 36 p 2 r x d 0 2 36 p 1 k l c 0 3 36 p 0 s t r 0 s t c / 0 4 31 p 7 t n i 5 u d i 5 31 p 6 t n i 4 w d i 6 31 p 5 t n i 3 v d id a g r t 7 30 1 p 7 i k 3 n a 7 8 30 1 p 6 i k 2 n a 6 9 30 1 p 5 i k 1 n a 5 0 40 1 p 4 i k 0 n a 4 1 40 1 p 3 n a 3 2 40 1 p 2 n a 2 3 40 1 p 1 n a 1 4 4s s v a 5 40 1 p 0 n a 0 6 4v f e r 7 4c c v a 8 49 p 3 2 n a 4
1. overview page 13 9 2 3 f o 7 0 0 2 , 5 1 . b e f 0 0 . 2 . v e r 0 0 2 0 - 2 0 2 0 b 9 0 j e r ) t 6 2 / c 6 1 m , b 6 2 / c 6 1 m , a 6 2 / c 6 1 m ( p u o r g a 6 2 / c 6 1 m 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 42 41 40 39 38 37 36 35 34 33 32 31 30 29 28 27 26 25 24 23 22 reset av ss p10 0 /an 0 v ref x in x out v ss v cc p8 6 /x cout p6 5 /clk 1 p8 3 /int 1 p8 2 /int 0 p8 1 /ta4 in /u p8 0 /ta4 out /u p7 7 /ta3 in p7 6 /ta3 out p7 5 /ta2 in /w p7 4 /ta2 out /w p6 4 /cts 1 /rts 1 /cts 0 /clks 1 p7 0 /txd 2 /sda 2 /ta0 out /cts 1 /rts 1 /cts 0 /clks 1 p7 1 /rxd 2 /scl 2 /ta0 in /clk 1 p7 2 /clk 2 /ta1 out /v/rxd 1 p7 3 /cts 2 /rts 2 /ta1 in /v/txd 1 av cc p9 1 /tb1 in /an 31 p9 0 /tb0 in /an 30 /clk out cnv ss p8 7 /x cin p6 6 /rxd 1 p6 7 /txd 1 p8 5 /nmi/sd p8 4 /int 2 /zp p1 7 /int 5 /idu p1 6 /int 4 /idw p1 5 /int 3 /ad trg /idv p10 7 /an 7 /ki 3 p10 6 /an 6 /ki 2 p10 5 /an 5 /ki 1 p10 4 /an 4 /ki 0 p10 3 /an 3 p10 2 /an 2 p10 1 /an 1 note: 1. set pacr2 to pacr0 bit in the pacr register to "001 2 " before you input and output it after resetting to each pin. when the pacr register isn't set up, the input and output function of some of the p ins are disabled. package: prsp0042ga-b (42p2r) figure 1.7 pin assignment for 42-pin package (top view)
1. overview page 14 9 2 3 f o 7 0 0 2 , 5 1 . b e f 0 0 . 2 . v e r 0 0 2 0 - 2 0 2 0 b 9 0 j e r ) t 6 2 / c 6 1 m , b 6 2 / c 6 1 m , a 6 2 / c 6 1 m ( p u o r g a 6 2 / c 6 1 m table 1.12 pin characteristics for 42-pin package n i p . o n l o r t n o c n i p t r o p t p u r r e t n i n i p n i p r e m i tn i p t r a un i p g o l a n a 1s s v a 20 1 p 0 n a 0 3v f e r 4v a c c 59 p 1 b t n i 1 3 n a 1 69 p 0 b t n i 0 k l c t u o 3 n a 0 7s s v n c 8x n i c 8 p 7 9x t u o c 8 p 6 0 1t e s e r 1 1x t u o 2 1s s v 3 1x n i 4 1v c c 5 18 p 5 i m nd s 6 18 p 4 t n i 2 p z 7 18 p 3 t n i 1 8 18 p 2 t n i 0 9 18 p 1 a t n i 4 u / 0 28 p 0 a t t u o 4 u / 1 27 p 7 a t n i 3 2 27 p 6 a t t u o 3 3 27 p 5 a t n i 2 w / 4 27 p 4 a t t u o 2 w / 5 27 p 3 a t n i 1 v /s t c 2 s t r / 2 t / x d 1 6 27 p 2 a t t u o 1 v /k l c 2 r / x d 1 7 27 p 1 a t n i 0 r x d 2 l c s / 2 k l c / 1 8 27 p 0 a t t u o 0 t x d 2 a d s / 2 s t r / 1 s t c / 1 s t c / 0 s k l c / 1 9 26 p 7 t x d 1 0 36 p 6 r x d 1 1 36 p 5 k l c 1 2 36 p 4 s t r 1 s t c / 1 s t c / 0 s k l c / 1 3 31 p 7 t n i 5 u d i 4 31 p 6 t n i 4 w d i 5 31 p 5 t n i 3 v d id a g r t 6 30 1 p 7 i k 3 n a 7 7 30 1 p 6 i k 2 n a 6 8 30 1 p 5 i k 1 n a 5 9 30 1 p 4 i k 0 n a 4 0 40 1 p 3 n a 3 1 40 1 p 2 n a 2 2 40 1 p 1 n a 1
1. overview page 15 9 2 3 f o 7 0 0 2 , 5 1 . b e f 0 0 . 2 . v e r 0 0 2 0 - 2 0 2 0 b 9 0 j e r ) t 6 2 / c 6 1 m , b 6 2 / c 6 1 m , a 6 2 / c 6 1 m ( p u o r g a 6 2 / c 6 1 m 1.6 pin description apply 0v to the vss pin. apply following voltage to the vcc pin. 2.7 to 5.5 v (m16c/26a, m16c/26b), 3.0 to 5.5 v (m16c/26t t-ver.), 4.2 to 5.5 v (m16c/26t v-ver.) supplies power to the a/d converter. connect the av cc pin to v cc and the av ss pin to v ss ___________ the mcu is in a reset state when "l" is applied to the reset pin connect the cnv ss pin to v ss i/o pins for the main clock oscillation circuit. connect a ceramic resonator or crystal oscillator between x in and x out . to apply external clock, apply it to x in and leave x out open. if x in is not used (for external oscillator or external clock), connect x in pin to v cc and leave x out open i/o pins for the sub clock oscillation circuit. connect a crystal oscillator between x cin and x cout outputs the clock having the same frequency as f1, f 8 , f 32 , or f c ______ ________ input pins for the int interrupt. int2 can be used for timer a z-phase function _______ _______ nmi interrupt input pin. nmi cannot be used as i/o port while the three-phase _______ motor control is enabled. apply a stable "h" to nmi after setting it's direction register to "0" when the three-phase motor control is enabled input pins for the key input interrupt i/o pins for the timer a0 to a4 input pins for the timer a0 to a4 input pin for z-phase timer b0 to b1 input pins output pins for the three-phase motor control timer i/o pins for the three-phase motor control timer input pins to control data transmission output pins to control data reception inputs and outputs the transfer clock inputs serial data outputs serial data output pin for transfer clock applies reference voltage to the a/d converter analog input pins for the a/d converter input pin for an external a/d trigger i/o ports for cmos. each port can be programmed for input or output under the control of the direction register. an input port can be set, by program, for a pull-up resistor available or for no pull-up resister available in 3-bit units cmos i/o ports which have a direction register determines an individual pin used as an input port or an output port. a pull-up resistor is selectable for every 4 input ports v cc, v ss av cc av ss ____________ reset cnv ss x in x out x cin x cout clk out ________ ________ int0 to int5 _______ nmi _____ _____ ki 0 to ki 3 ta0 out to ta4 out ta0 in to ta4 in zp tb0 in to tb1 in ___ ___ u, u, v, v, ___ w, w idu, idw, _____ idv, sd _________ _________ cts1 to cts2 _________ _________ rts1 to rts2 clk1 to clk2 rxd1 to rxd2 txd1 to txd2 clks1 v ref an 0 to an 7 an3 0 to an3 1 ___________ ad trg p1 5 to p1 7 p6 4 to p6 7 p7 0 to p7 7 p8 0 to p8 7 p10 0 to p10 7 p9 0 to p9 1 power supply analog power supply reset input cnvss main clock input main clock output sub clock input sub clock output clock output ______ int interrupt input _______ nmi interrupt input key input interrupt timer a timer b three-phase motor control timer output serial i/o reference voltage input a/d converter i/o ports i i i i i o i o o i i i i/o i i i o i/o i o i/o i o o i i i i/o i/o i : input o : output i/o : input and output classification pin name i/o type description table 1.13 pin description (48-pin and 42-pin packages)
1. overview page 16 9 2 3 f o 7 0 0 2 , 5 1 . b e f 0 0 . 2 . v e r 0 0 2 0 - 2 0 2 0 b 9 0 j e r ) t 6 2 / c 6 1 m , b 6 2 / c 6 1 m , a 6 2 / c 6 1 m ( p u o r g a 6 2 / c 6 1 m inputs pin to control data transmission output pin to control data reception inputs and outputs the transfer clock inputs serial data outputs serial data timer b2 input pin analog input pins for the a/d converter cmos i/o ports which have a direction register determines an individual pin used as an input port or an output port. a pull-up resistor is selectable for every 4 input ports _________ cts0 _________ rts0 clk0 rxd0 txd0 tb2in an2 4 an3 2 p6 0 to p6 3 p9 2 to p9 3 serial i/o timer b a/d converter i/o ports i o i/o i o i i i/o classification pin name i/o type description table 1.13 pin description ( 48-pin packages only) (continued) i : input o : output i/o : input and output
2. cpu page 17 ) t 6 2 / c 6 1 m , b 6 2 / c 6 1 m , a 6 2 / c 6 1 m ( p u o r g a 6 2 / c 6 1 m 9 2 3 f o 7 0 0 2 , 5 1 . b e f 0 0 . 2 . v e r 0 0 2 0 - 2 0 2 0 b 9 0 j e r 2. central processing unit (cpu) figure 2.1 shows the cpu registers. the register bank is comprised of seven registers (r0, r1, r2, r3, a0, a1 and fb) out of 13 registers. there are two sets of register bank. figure 2.1. cpu register 2.1 data registers (r0, r1, r2 and r3) the r0 register consists of 16 bits, and is used mainly for transfers and arithmetic/logic operations. r1 to r3 are the same as r0. the r0 register can be separated between high (r0h) and low (r0l) for use as two 8-bit data registers. r1h and r1l are the same as r0h and r0l. conversely, r2 and r0 can be combined for use as a 32-bit data register (r2r0). r3r1 is the same as r2r0. 2.2 address registers (a0 and a1) the register a0 consists of 16 bits, and is used for address register indirect addressing and address regis- ter relative addressing. they also are used for transfers and arithmetic/logic operations. a1 is the same as a0. in some instructions, registers a1 and a0 can be combined for use as a 32-bit address register (a1a0). data registers (1) address registers (1) frame base registers (1) program counter interrupt table register user stack pointer interrupt stack pointer static base register flag register note: 1. these registers comprise a register bank. there are two register banks. r0h(r0's high bits) b15 b8 b7 b0 r3 intbh usp isp sb r0l(r0's low bits) r1h(r1's high bits) r1l(r1's low bits) r2 b31 r3 r2 a1 a0 fb b19 intbl b15 b0 pc b19 b0 b15 b0 flg b15 b0 b15 b0 b7 b8 b reserved area carry flag debug flag zero flag sign flag register bank select flag overflow flag interrupt enable flag stack pointer select flag reserved area processor interrupt priority level the upper 4 bits of intb are intbh and the lower 16 bits of intb are intbl.
2. cpu page 18 ) t 6 2 / c 6 1 m , b 6 2 / c 6 1 m , a 6 2 / c 6 1 m ( p u o r g a 6 2 / c 6 1 m 9 2 3 f o 7 0 0 2 , 5 1 . b e f 0 0 . 2 . v e r 0 0 2 0 - 2 0 2 0 b 9 0 j e r 2.3 frame base register (fb) fb is configured with 16 bits, and is used for fb relative addressing. 2.4 interrupt table register (intb) intb is configured with 20 bits, indicating the start address of an interrupt vector table. 2.5 program counter (pc) pc is configured with 20 bits, indicating the address of an instruction to be executed. 2.6 user stack pointer (usp) and interrupt stack pointer (isp) stack pointer (sp) comes in two types: usp and isp, each configured with 16 bits. your desired type of stack pointer (usp or isp) can be selected by the u flag of flg. 2.7 static base register (sb) sb is configured with 16 bits, and is used for sb relative addressing. 2.8 flag register (flg) flg consists of 11 bits, indicating the cpu status. 2.8.1 carry flag (c flag) this flag retains a carry, borrow, or shift-out bit that has occurred in the arithmetic/logic unit. 2.8.2 debug flag (d flag) the d flag is used exclusively for debugging purpose. during normal use, it must be set to 0. 2.8.3 zero flag (z flag) this flag is set to 1 when an arithmetic operation resulted in 0; otherwise, it is 0. 2.8.4 sign flag (s flag) this flag is set to 1 when an arithmetic operation resulted in a negative value; otherwise, it is 0. 2.8.5 register bank select flag (b flag) register bank 0 is selected when this flag is 0 ; register bank 1 is selected when this flag is 1. 2.8.6 overflow flag (o flag) this flag is set to 1 when the operation resulted in an overflow; otherwise, it is 0. 2.8.7 interrupt enable flag (i flag) this flag enables a maskable interrupt. maskable interrupts are disabled when the i flag is 0, and are enabled when the i flag is 1. the i flag is cleared to 0 when the interrupt request is accepted. 2.8.8 stack pointer select flag (u flag) isp is selected when the u flag is 0; usp is selected when the u flag is 1. the u flag is cleared to 0 when a hardware interrupt request is accepted or an int instruction for software interrupt nos. 0 to 31 is executed. 2.8.9 processor interrupt priority level (ipl) ipl is configured with three bits, for specification of up to eight processor interrupt priority levels from level 0 to level 7. if a requested interrupt has priority greater than ipl, the interrupt is enabled. 2.8.10 reserved area when write to this bit, write 0. when read, its content is undefined.
3. memory page 19 ) t 6 2 / c 6 1 m , b 6 2 / c 6 1 m , a 6 2 / c 6 1 m ( p u o r g a 6 2 / c 6 1 m 9 2 3 f o 7 0 0 2 , 5 1 . b e f 0 0 . 2 . v e r 0 0 2 0 - 2 0 2 0 b 9 0 j e r 3. memory figure 3.1 is a memory map of the m16c/26a group (m16c/26a, m16c/26b, m16c/26t). the m16c/26a group provides 1-mbyte address space addresses 00000 16 to fffff 16 . the internal rom is allocated lower address, beginning with address fffff 16 . for example, a 64-kbyte internal rom area is allocated in addresses f0000 16 to fffff 16 . the flash memory version has two sets of 2-kbyte internal rom area, block a and block b, for data space. these blocks are allocated addresses f000 16 to ffff 16 . the fixed interrupt vectors are allocated addresses fffdc 16 to fffff 16 and they store the start address of each interrupt routine. the internal ram is allocated higher addresses, beginning with address 00400 16 . for example, a 1-kbyte internal ram area is allocated in addresses 00400 16 to 007ff 16 . the internal ram is used for temporarily storing data. the area is also used as stacks when subroutines are called or interrupt requests are ac- knowledged. the sfr is allocated addresses 00000 16 to 003ff 16 . the peripheral function control registers are allo- cated here. all blank spaces within sfr location are reserved and cannot be accessed by users. the special page vectors are allocated addresses ffe00 16 to fffdb 16 . they are used for the jmps instruction and jsrs instruction. refer to the renesas publication m16c/60 and m16c/20 series soft- ware manual for details. figure 3.1 memory map 00000 16 xxxxx 16 internal rom (data space) internal rom (program space) sfr internal ram reserved ffe00 16 fffdc 16 fffff 16 note: 1. block a (2 kbytes) and block b (2 kbytes). 2. do not write to the internal rom in mask rom version. undefined instruction overflow brk instruction address match single step watchdog timer reset special page vector table dbc nmi 1k bytes 007ff 16 00bff 16 address xxxxx 16 2k bytes size address yyyyy 16 size f4000 16 fa000 16 48k bytes 24k bytes reserved 00400 16 0f000 16 0ffff 16 yyyyy 16 fffff 16 (1) f0000 16 64k bytes internal ram internal rom (2)
4. sfrs page 20 ) t 6 2 / c 6 1 m , b 6 2 / c 6 1 m , a 6 2 / c 6 1 m ( p u o r g a 6 2 / c 6 1 m 9 2 3 f o 7 0 0 2 , 5 1 . b e f 0 0 . 2 . v e r 0 0 2 0 - 2 0 2 0 b 9 0 j e r 4. special function registers (sfrs) table 4.1 sfr information(1) (1) processor mode register 0 pm0 00 16 processor mode register 1 pm1 00001000 2 system clock control register 0 cm0 01001000 2 (5) 01101000 2(m16c/26t) system clock control register 1 cm1 00100000 2 address match interrupt enable register aier xxxxxx00 2 protect register prcr xx000000 2 oscillation stop detection register (2) cm2 0x000000 2 watchdog timer start register wdts xx 16 watchdog timer control register wdc 00xxxxxx 2 address match interrupt register 0 rmad0 00 16 00 16 x0 16 address match interrupt register 1 rmad1 00 16 00 16 x0 16 voltage detection register 1 (3, 4) vcr1 00001000 2 voltage detection register 2 (3, 4) vcr2 00 16 pll control register 0 plc0 0001x010 2 processor mode register 2 pm2 xxx00000 2 low voltage detection interrupt register (4) d4int 00 16 dma0 source pointer sar0 xx 16 xx 16 xx 16 dma0 destination pointer dar0 xx 16 xx 16 xx 16 dma0 transfer counter tcr0 xx 16 xx 16 dma0 control register dm0con 00000x00 2 dma1 source pointer sar1 xx 16 xx 16 xx 16 dma1 destination pointer dar1 xx 16 xx 16 xx 16 dma1 transfer counter tcr1 xx 16 xx 16 dma1 control register dm1con 00000x00 2 notes: 1. the blank spaces are reserved. no access is allowed. 2. bits cm27, cm21, and cm20 do not change at oscillation stop detection reset. 3. the vcr1 and vcr2 registers do not change at software reset, watchdog timer reset, and oscillation stop detection reset . 4. registers vcr1, vcr2, and d4int cannot be used in m16c/26t. 5. m16c/26a, m16c/26b x : undefined 0000 16 0001 16 0002 16 0003 16 0004 16 0005 16 0006 16 0007 16 0008 16 0009 16 000a 16 000b 16 000c 16 000d 16 000e 16 000f 16 0010 16 0011 16 0012 16 0013 16 0014 16 0015 16 0016 16 0017 16 0018 16 0019 16 001a 16 001b 16 001c 16 001d 16 001e 16 001f 16 0020 16 0021 16 0022 16 0023 16 0024 16 0025 16 0026 16 0027 16 0028 16 0029 16 002a 16 002b 16 002c 16 002d 16 002e 16 002f 16 0030 16 0031 16 0032 16 0033 16 0034 16 0035 16 0036 16 0037 16 0038 16 0039 16 003a 16 003b 16 003c 16 003d 16 003e 16 003f 16 address register symbol after reset
4. sfrs page 21 ) t 6 2 / c 6 1 m , b 6 2 / c 6 1 m , a 6 2 / c 6 1 m ( p u o r g a 6 2 / c 6 1 m 9 2 3 f o 7 0 0 2 , 5 1 . b e f 0 0 . 2 . v e r 0 0 2 0 - 2 0 2 0 b 9 0 j e r note: 1. blank spaces are reserved. no access is allowed. x: undefined 0040 16 0041 16 0042 16 0043 16 0044 16 0045 16 0046 16 0047 16 0048 16 0049 16 004a 16 004b 16 004c 16 004d 16 004e 16 004f 16 0050 16 0051 16 0052 16 0053 16 0054 16 0055 16 0056 16 0057 16 0058 16 0059 16 005a 16 005b 16 005c 16 005d 16 005e 16 005f 16 0060 16 0061 16 0062 16 0063 16 0064 16 0065 16 0066 16 0067 16 0068 16 0069 16 006a 16 006b 16 006c 16 006d 16 006e 16 006f 16 0070 16 0071 16 0072 16 0073 16 0074 16 0075 16 0076 16 0077 16 0078 16 0079 16 007a 16 007b 16 007c 16 007d 16 007e 16 007f 16 address register symbol after reset int3 interrupt control register int3ic xx00x000 2 int5 interrupt control register int5ic xx00x000 2 int4 interrupt control register int4ic xx00x000 2 uart2 bus collision detection interrupt control register bcnic xxxxx000 2 dma0 interrupt control register dm0ic xxxxx000 2 dma1 interrupt control register dm1ic xxxxx000 2 key input interrupt control register kupic xxxxx000 2 a/d conversion interrupt control register adic xxxxx000 2 uart2 transmit interrupt control register s2tic xxxxx000 2 uart2 receive interrupt control register s2ric xxxxx000 2 uart0 transmit interrupt control register s0tic xxxxx000 2 uart0 receive interrupt control register s0ric xxxxx000 2 uart1 transmit interrupt control register s1tic xxxxx000 2 uart1 receive interrupt control register s1ric xxxxx000 2 timera0 interrupt control register ta0ic xxxxx000 2 timera1 interrupt control register ta1ic xxxxx000 2 timera2 interrupt control register ta2ic xxxxx000 2 timera3 interrupt control register ta3ic xxxxx000 2 timera4 interrupt control register ta4ic xxxxx000 2 timerb0 interrupt control register tb0ic xxxxx000 2 timerb1 interrupt control register tb1ic xxxxx000 2 timerb2 interrupt control register tb2ic xxxxx000 2 int0 interrupt control register int0ic xx00x000 2 int1 interrupt control register int1ic xx00x000 2 int2 interrupt control register int2ic xx00x000 2 table 4.2 sfr information(2) (1)
4. sfrs page 22 ) t 6 2 / c 6 1 m , b 6 2 / c 6 1 m , a 6 2 / c 6 1 m ( p u o r g a 6 2 / c 6 1 m 9 2 3 f o 7 0 0 2 , 5 1 . b e f 0 0 . 2 . v e r 0 0 2 0 - 2 0 2 0 b 9 0 j e r 0080 16 0081 16 0082 16 0083 16 0084 16 0085 16 0086 16 01b0 16 01b1 16 01b2 16 01b3 16 01b4 16 01b5 16 01b6 16 01b7 16 01b8 16 01b9 16 01ba 16 01bb 16 01bc 16 01bd 16 01be 16 01bf 16 0250 16 0251 16 0252 16 0253 16 0254 16 0255 16 0256 16 0257 16 0258 16 0259 16 025a 16 025b 16 025c 16 025d 16 025e 16 025f 16 0330 16 0331 16 0332 16 0333 16 0334 16 0335 16 0336 16 0337 16 0338 16 0339 16 033a 16 033b 16 033c 16 033d 16 033e 16 033f 16 notes: 1. blank spaces are reserved. no access is allowed. 2. this register is included in the flash memory version. x: undefined address register symbol after reset flash memory control register 4 (2) fmr4 01000000 2 flash memory control register 1 (2) fmr1 000xxx0x 2 flash memory control register 0 (2) fmr0 01 16 three phase protect control register tprc 00 16 on-chip oscillator control register rocr x0000101 2 pin assignment control register pacr 00 16 peripheral clock select register pclkr 00000011 2 nmi digital debounce register nddr ff 16 port1 7 digital debounce register p17ddr ff 16 ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ table 4.3 sfr information(3) (1)
4. sfrs page 23 ) t 6 2 / c 6 1 m , b 6 2 / c 6 1 m , a 6 2 / c 6 1 m ( p u o r g a 6 2 / c 6 1 m 9 2 3 f o 7 0 0 2 , 5 1 . b e f 0 0 . 2 . v e r 0 0 2 0 - 2 0 2 0 b 9 0 j e r address register symbol after reset 0340 16 0341 16 0342 16 0343 16 0344 16 0345 16 0346 16 0347 16 0348 16 0349 16 034a 16 034b 16 034c 16 034d 16 034e 16 034f 16 0350 16 0351 16 0352 16 0353 16 0354 16 0355 16 0356 16 0357 16 0358 16 0359 16 035a 16 035b 16 035c 16 035d 16 035e 16 035f 16 0360 16 0361 16 0362 16 0363 16 0364 16 0365 16 0366 16 0367 16 0368 16 0369 16 036a 16 036b 16 036c 16 036d 16 036e 16 036f 16 0370 16 0371 16 0372 16 0373 16 0374 16 0375 16 0376 16 0377 16 0378 16 0379 16 037a 16 037b 16 037c 16 037d 16 037e 16 037f 16 note: 1. blank spaces are reserved. no access is allowed. 2. write "1" to bit 0 after reset. x : undefined timer a1-1 register ta11 xx 16 xx 16 timer a2-1 register ta21 xx 16 xx 16 timer a4-1 register ta41 xx 16 xx 16 three phase pwm control register 0 invc0 00 16 three phase pwm control register 1 invc1 00 16 three phase output buffer register 0 idb0 00111111 2 three phase output buffer register 1 idb1 00111111 2 dead time timer dtt xx 16 timer b2 interrupt occurrence frequency set counter ictb2 xx 16 position-data-retain function control register pdrf xxxx0000 2 port function control register pfcr 00111111 2 interrupt request cause select register 2 ifsr2a xxxxxxx0 2 (2) interrupt request cause select register ifsr 00 16 uart2 special mode register 4 u2smr4 00 16 uart2 special mode register 3 u2smr3 000x0x0x 2 uart2 special mode register 2 u2smr2 x0000000 2 uart2 special mode register u2smr x0000000 2 uart2 transmit/receive mode register u2mr 00 16 uart2 bit rate register u2brg xx 16 uart2 transmit buffer register u2tb xxxxxxxx 2 xxxxxxxx 2 uart2 transmit/receive control register 0 u2c0 00001000 2 uart2 transmit/receive control register 1 u2c1 00000010 2 uart2 receive buffer register u2rb xxxxxxxx 2 xxxxxxxx 2 table 4.4 sfr information(4) (1)
4. sfrs page 24 ) t 6 2 / c 6 1 m , b 6 2 / c 6 1 m , a 6 2 / c 6 1 m ( p u o r g a 6 2 / c 6 1 m 9 2 3 f o 7 0 0 2 , 5 1 . b e f 0 0 . 2 . v e r 0 0 2 0 - 2 0 2 0 b 9 0 j e r table 4.5 sfr information(5) (1) 0380 16 0381 16 0382 16 0383 16 0384 16 0385 16 0386 16 0387 16 0388 16 0389 16 038a 16 038b 16 038c 16 038d 16 038e 16 038f 16 0390 16 0391 16 0392 16 0393 16 0394 16 0395 16 0396 16 0397 16 0398 16 0399 16 039a 16 039b 16 039c 16 039d 16 039e 16 039f 16 03a0 16 03a1 16 03a2 16 03a3 16 03a4 16 03a5 16 03a6 16 03a7 16 03a8 16 03a9 16 03aa 16 03ab 16 03ac 16 03ad 16 03ae 16 03af 16 03b0 16 03b1 16 03b2 16 03b3 16 03b4 16 03b5 16 03b6 16 03b7 16 03b8 16 03b9 16 03ba 16 03bb 16 03bc 16 03bd 16 03be 16 03bf 16 note: 1. blank spaces are reserved. no access is allowed. x : undefined address register symbol after reset count start flag tabsr 00 16 clock prescaler reset flag cpsrf 0xxxxxxx 2 one-shot start flag onsf 00 16 trigger select register trgsr 00 16 up-dowm flag udf 00 16 timer a0 register ta0 xx 16 xx 16 timer a1 register ta1 xx 16 xx 16 timer a2 register ta2 xx 16 xx 16 timer a3 register ta3 xx 16 xx 16 timer a4 register ta4 xx 16 xx 16 timer b0 register tb0 xx 16 xx 16 timer b1 register tb1 xx 16 xx 16 timer b2 register tb2 xx 16 xx 16 timer a0 mode register ta0mr 00 16 timer a1 mode register ta1mr 00 16 timer a2 mode register ta2mr 00 16 timer a3 mode register ta3mr 00 16 timer a4 mode register ta4mr 00 16 timer b0 mode register tb0mr 00xx0000 2 timer b1 mode register tb1mr 00xx0000 2 timer b2 mode register tb2mr 00xx0000 2 timer b2 special mode register tb2sc x0000000 2 uart0 transmit/receive mode register u0mr 00 16 uart0 bit rate register u0brg xx 16 uart0 transmit buffer register u0tb xxxxxxxx 2 xxxxxxxx 2 uart0 transmit/receive control register 0 u0c0 00001000 2 uart0 transmit/receive control register 1 u0c1 00000010 2 uart0 receive buffer register u0rb xxxxxxxx 2 xxxxxxxx 2 uart1 transmit/receive mode register u1mr 00 16 uart1 bit rate register u1brg xx 16 uart1 transmit buffer register u1tb xxxxxxxx 2 xxxxxxxx 2 uart1 transmit/receive control register 0 u1c0 00001000 2 uart1 transmit/receive control register 1 u1c1 00000010 2 uart1 receive buffer register u1rb xxxxxxxx 2 xxxxxxxx 2 uart transmit/receive control register 2 ucon x0000000 2 crc snoop address register crcsar xx 16 00xxxxxx 2 crc mode register crcmr 0xxxxxx0 2 dma0 request cause select register dm0sl 00 16 dma1 request cause select register dm1sl 00 16 crc data register crcd xx 16 xx 16 crc input register crcin xx 16
4. sfrs page 25 ) t 6 2 / c 6 1 m , b 6 2 / c 6 1 m , a 6 2 / c 6 1 m ( p u o r g a 6 2 / c 6 1 m 9 2 3 f o 7 0 0 2 , 5 1 . b e f 0 0 . 2 . v e r 0 0 2 0 - 2 0 2 0 b 9 0 j e r table 4.6 sfr information(6) (1) 03c0 16 03c1 16 03c2 16 03c3 16 03c4 16 03c5 16 03c6 16 03c7 16 03c8 16 03c9 16 03ca 16 03cb 16 03cc 16 03cd 16 03ce 16 03cf 16 03d0 16 03d1 16 03d2 16 03d3 16 03d4 16 03d5 16 03d6 16 03d7 16 03d8 16 03d9 16 03da 16 03db 16 03dc 16 03dd 16 03de 16 03df 16 03e0 16 03e1 16 03e2 16 03e3 16 03e4 16 03e5 16 03e6 16 03e7 16 03e8 16 03e9 16 03ea 16 03eb 16 03ec 16 03ed 16 03ee 16 03ef 16 03f0 16 03f1 16 03f2 16 03f3 16 03f4 16 03f5 16 03f6 16 03f7 16 03f8 16 03f9 16 03fa 16 03fb 16 03fc 16 03fd 16 03fe 16 03ff 16 note: 1. blank spaces are reserved. no access is allowed. x: undefined register symbol after reset a/d register 0 ad0 xxxxxxxx 2 xxxxxxxx 2 a/d register 1 ad1 xxxxxxxx2 xxxxxxxx 2 a/d register 2 ad2 xxxxxxxx 2 xxxxxxxx 2 a/d register 3 ad3 xxxxxxxx 2 xxxxxxxx 2 a/d register 4 ad4 xxxxxxxx 2 xxxxxxxx 2 a/d register 5 ad5 xxxxxxxx 2 xxxxxxxx 2 a/d register 6 ad6 xxxxxxxx 2 xxxxxxxx 2 a/d register 7 ad7 xxxxxxxx 2 xxxxxxxx 2 a/d trigger control register adtrgcon 00 16 a/d status register 0 adstat0 00000x00 2 a/d control register 2 adcon2 00 16 a/d control register 0 adcon0 00000xxx 2 a/d control register 1 adcon1 00 16 port p1 register p1 xx 16 port p1 direction register pd1 00 16 port p6 register p6 xx 16 port p7 register p7 xx 16 port p6 direction register pd6 00 16 port p7 direction register pd7 00 16 port p8 register p8 xx 16 port p9 register p9 xxxxxxxx 2 port p8 direction register pd8 00 16 port p9 direction register pd9 xxxx0000 2 port p10 register p10 xx 16 port p10 direction register pd10 00 16 pull-up control register 0 pur0 00 16 pull-up control register 1 pur1 00 16 pull-up control register 2 pur2 00 16 port control register pcr 00 16 address
5. reset page 26 9 2 3 f o 7 0 0 2 , 5 1 . b e f 0 0 . 2 . v e r 0 0 2 0 - 2 0 2 0 b 9 0 j e r ) t 6 2 / c 6 1 m , b 6 2 / c 6 1 m , a 6 2 / c 6 1 m ( p u o r g a 6 2 / c 6 1 m 5. reset there are four types of resets: a hardware reset, a software reset, an watchdog timer reset, and an oscilla- tion stop detection reset. 5.1 hardware reset there are two types of hardware resets: a hardware reset 1 and a hardware reset 2. 5.1.1 hardware reset 1 ____________ ____________ a reset is applied using the reset pin. when an l signal is applied to the reset pin while the power supply voltage is within the recommended operating condition, the pins are initialized (see ____________ table 5.1.1.1 pin status when reset pin level is l ). the internal on-chip oscillator is initialized and used as cpu clock. ____________ when the input level at the reset pin is released from l to h , the cpu and sfr are initialized, and the program is executed starting from the address indicated by the reset vector. the internal ram ____________ is not initialized. if the reset pin is pulled l while writing to the internal ram, the internal ram becomes indeterminate. figure 5.1.1.1 shows the example reset circuit. figure 5.1.1.2 shows the reset sequence. table ____________ 5.1.1.1 shows the status of the other pins while the reset pin is l . figure 5.1.1.3 shows the cpu register status after reset. refer to sfr map for sfr status after reset. 1. when the power supply is stable ____________ (1) apply an l signal to the reset pin. (2) wait td(roc) or more. ____________ (3) apply an h signal to the reset pin. 2. power on ____________ (1) apply an l signal to the reset pin. (2) let the power supply voltage increase until it meets the recommended operating condition. (3) wait td(p-r) or more until the internal power supply stabilizes. (4) wait td(roc) or more. ____________ (5) apply an h signal to the reset pin. 5.1.2 hardware reset 2 note m16c/26t does not use this function. this reset is generated by the microcomputer s internal voltage detection circuit. the voltage detec- tion circuit monitors the voltage supplied to the v cc pin. if the vc26 bit in the vcr2 register is set to 1 (reset level detection circuit enabled), the microcom- puter is reset when the voltage at the v cc input pin drops below vdet3. conversely, when the input voltage at the v cc pin rises to vdet3r or more, the pins and the cpu and sfr are initialized, and the program is executed starting from the address indicated by the reset vector. it takes about td(s-r) before the program starts running after vdet3r is detected. the initialized pins and registers and the status thereof are the same as in hardware reset 1. the microcomputer cannot exit stop mode by voltage down detection reset (hardware reset 2).
5. reset page 27 9 2 3 f o 7 0 0 2 , 5 1 . b e f 0 0 . 2 . v e r 0 0 2 0 - 2 0 2 0 b 9 0 j e r ) t 6 2 / c 6 1 m , b 6 2 / c 6 1 m , a 6 2 / c 6 1 m ( p u o r g a 6 2 / c 6 1 m 5.2 software reset when the pm03 bit in the pm0 register is set to 1 (microcomputer reset), the microcomputer has its pins, cpu, and sfr initialized. then the program is executed starting from the address indicated by the reset vector. the device will reset using on-chip oscillator as the cpu clock. at software reset, some sfr s are not initialized. refer to sfr . 5.3 watchdog timer reset when the pm12 bit in the pm1 register is 1 (reset when watchdog timer underflows), the microcomputer initializes its pins, cpu and sfr if the watchdog timer underflows. the device will reset using on-chip oscillator as the system clock. then the program is executed starting from the address indicated by the reset vector. at watchdog timer reset, some sfr s are not initialized. refer to sfr . 5.4 oscillation stop detection reset when the cm20 bit in the cm2 register is set to 1 (oscillation stop, re-oscillation detection function enabled) and the cm27 bit is set to 0 (reset at oscillation stop detection), the microcomputer initializes its pins, cpu and sfr, coming to a halt if it detects main clock oscillation circuit stop. refer to the section oscillation stop, re-oscillation detection function . at oscillation stop detection reset, some sfr s are not initialized. refer to the section sfr . figure 5.1.1.1. example reset circuit reset v cc reset v cc 0v 0v more than td(roc) + td(p-r) equal to or less than 0.2v cc equal to or less than 0.2v cc recommended operating voltage
5. reset page 28 9 2 3 f o 7 0 0 2 , 5 1 . b e f 0 0 . 2 . v e r 0 0 2 0 - 2 0 2 0 b 9 0 j e r ) t 6 2 / c 6 1 m , b 6 2 / c 6 1 m , a 6 2 / c 6 1 m ( p u o r g a 6 2 / c 6 1 m ____________ table 5.1.1.1. pin status when reset pin level is ? status pin name p1, p6 to p10 input port (high impedance) figure 5.1.1.3. cpu register status after reset b15 b0 data register(r0) address register(a0) frame base register(fb) program counter(pc) interrupt table register(intb) user stack pointer(usp) interrupt stack pointer(isp) static base register(sb) flag register(flg) 0000 16 0000 16 0000 16 aa aa a a aa aa aa aa aaaaaa aaaaaa aa aa aa aa aa aa a a aa aa c d z s b o i u ipl 0000 16 0000 16 0000 16 0000 16 0000 16 b19 b0 content of addresses ffffe 16 to ffffc 16 b15 b0 b15 b0 b15 b0 b7 b8 00000 16 data register(r1) data register(r2) data register(r3) address register(a1) 0000 16 0000 16 0000 16 figure 5.1.1.2. reset sequence td(p-r) more than td(roc) cpu clock address roc reset content of reset vector cpu clock 28 cycles ffffe 16 ffffc 16 v cc
5. reset page 29 9 2 3 f o 7 0 0 2 , 5 1 . b e f 0 0 . 2 . v e r 0 0 2 0 - 2 0 2 0 b 9 0 j e r ) t 6 2 / c 6 1 m , b 6 2 / c 6 1 m , a 6 2 / c 6 1 m ( p u o r g a 6 2 / c 6 1 m figure 5.5.1. voltage detection circuit block b7 b6 vcr2 register reset cm10 bit=1 (stop mode) + >vdet3 + >vdet4 e noise rejection low voltage detect signal b3 vcr1 register vc13 bit >t q 1 shot internal reset signal ( l active) e vcc td(s-r) brown-out detect reset (hardware reset 2 release wait time) reset level detection circuit low voltage detection circuit 5.5 voltage detection circuit note v cc =5 v is assumed. voltage detection circuit is not available in m16c/26t. the voltage detection circuit has circuits to monitor the input voltage at the v cc pin, each checking the input voltage with respect to vdet3, and vdet4, respectively. use the vc26 to vc27 bits in the vcr2 register to select whether or not to enable these circuits. use the reset level detection circuit for hardware reset 2. the voltage down detection circuit can be set to detect whether the input voltage is equal to or greater than vdet4 or less than vdet4 by monitoring the vc13 bit in the vcr1 register. furthermore, a voltage down detection interrupt can be generated.
5. reset page 30 9 2 3 f o 7 0 0 2 , 5 1 . b e f 0 0 . 2 . v e r 0 0 2 0 - 2 0 2 0 b 9 0 j e r ) t 6 2 / c 6 1 m , b 6 2 / c 6 1 m , a 6 2 / c 6 1 m ( p u o r g a 6 2 / c 6 1 m figure 5.5.2. vcr1 register, vcr2 register, and d4int register vc13 v o l t a g e d e t e c t i o n r e g i s t e r 1 s y m b o la d d r e s sa f t e r r e s e t ( 2) v c r 10 0 1 9 1 6 0 0 0 0 1 0 0 0 2 v o l t a g e d o w n m o n i t o r f l a g (1) bit name f unction b i t s y m b o l rw b7 b6 b 5b 4b 3b 2b 1b 0 0:v cc < vdet4 1:v cc 0 m u s t s e t t o 0 v o l t a g e d e t e c t i o n r e g i s t e r 2 (1) s y m b o la d d r e s sa f t e r r e s e t (5) v c r 20 0 1 a 1 6 0 0 1 6 b i t n a m e b i t s y m b o l b7 b6 b 5b 4b 3b 2b 1b 0 v c 2 6 vc27 rw rw rw rw 00000 f u n c t i o n reserved bit must set to 0 reset level monitor bit (2, 3, 6) 0 : d i s a b l e r e s e t l e v e l d e t e c t i o n c i r c u i t 1 : e n a b l e r e s e t l e v e l d e t e c t i o n c i r c u i t voltage down monitor bit (4, 6) 0: disable voltage down detection circuit 1: enable voltage down detection circuit ( b 2 - b 0 ) ( b 7 - b 4 ) ( b 5 - b 0 ) 0 notes: 1. the vc13 bit is useful when the vc27 bit in the vcr2 register is set to "1" (voltage down detection circuit enable). the vc13 bit is always "1" (vcc 1 (write enable). 2. when not in stop mode, to use hardware reset 2, set the vc26 bit to 1 (reset level detection circuit enable). 3. vc26 bit is disabled in stop mode. (the microcomputer is not reset even if the voltage input to vcc pin becomes lower than vdet3.) 4. when the vc13 bit in the vcr1 register and d42 bit in the d4int register are used or the d40 bit is set to 1 (voltage down detection interrupt enable), set the vc27 bit to 1 (voltage down detection circuit enable). 5. this register does not change at software reset, watchdog timer reset and oscillation stop detection reset. 6. the detection circuit does not start operation until td(e-a) elapses after the vc26 bit, or vc27 bit are set to 1 . d 4 0 v o l t a g e d o w n d e t e c t i o n i n t e r r u p t r e g i s t e r (1) s y m b o la d d r e s sa f t e r r e s e t d 4 i n t0 0 1 f 1 6 0 0 1 6 interrupt enable bit (5) bit name b i t s y m b o l b 7 b 6 b 5 b 4 b 3 b 2 b 1 b 0 0 : disable 1 : enable d 4 1 stop mode deactivation control bit (4) 0 : d i s a b l e ( d o n o t u s e t h e v o l t a g e d o w n d e t e c t i o n i n t e r r u p t t o g e t o u t o f s t o p m o d e ) 1 : e n a b l e ( u s e t h e v o l t a g e d o w n d e t e c t i o n i n t e r r u p t t o g e t o u t o f s t o p m o d e ) d 4 2 voltage change detection flag (2) 0: not detected 1: vdet4 passing detection d43 wdt overflow detect flag 0 : n o t d e t e c t e d 1 : d e t e c t e d df0 sampling clock select bit 0 0 : c p u c l o c k d i v i d e d b y 8 0 1 : c p u c l o c k d i v i d e d b y 1 6 1 0 : c p u c l o c k d i v i d e d b y 3 2 1 1 : c p u c l o c k d i v i d e d b y 6 4 d f 1 b 5 b 4 rw rw rw rw rw r w r w (b 7-b6) function nothing is assigned. when write, set to 0 . when read, its content is 0 . notes: 1. write to this register after setting the prc3 bit in the prcr register to 1 (write enable). 2. useful when the vc27 bit in the vcr2 register is set to 1 (voltage down detection circuit enabled). if the vc27 bit is set to 0 (voltage down detection circuit disable), the d42 bit is set to 0 (not detect). 3. this bit is set to 0 by writing a 0 in a program. (writing a 1 has no effect.) 4. if the voltage down detection interrupt needs to be used to get out of stop mode again after once used for that purpose, reset the d41 bit by writing a 0 and then a 1 . 5. the d40 bit is effective when the vc27 bit in the vcr2 register is set to 1 . to set the d40 bit to 1 , follow the procedure described below. (1) set the vc27 bit to 1 . (2) wait for td(e-a) until the detection circuit is actuated. (3) wait for the sampling time (refer to table 5.5.1.2 sampling clock periods ). (4) set the d40 bit to 1 . (3) (3)
5. reset page 31 9 2 3 f o 7 0 0 2 , 5 1 . b e f 0 0 . 2 . v e r 0 0 2 0 - 2 0 2 0 b 9 0 j e r ) t 6 2 / c 6 1 m , b 6 2 / c 6 1 m , a 6 2 / c 6 1 m ( p u o r g a 6 2 / c 6 1 m figure 5.5.3. typical operation of hardware reset 2 vdet4 vdet3 5.0v 5.0v vcc internal reset signal vc13 bit in vcr1 register vc26 bit in vcr2 register (1) vc27 bit in vcr2 register set to 1 by program (reset level detect circuit enable) set to 1 by program (voltage down detect circuit enable) vss indefinite indefinite indefinite reset vdet3s vdet3r notes : 1. vc26 bit is invalid (the microcomputer is not reset even if input voltage of vcc pin becomes lower than vdet3).
5. reset page 32 9 2 3 f o 7 0 0 2 , 5 1 . b e f 0 0 . 2 . v e r 0 0 2 0 - 2 0 2 0 b 9 0 j e r ) t 6 2 / c 6 1 m , b 6 2 / c 6 1 m , a 6 2 / c 6 1 m ( p u o r g a 6 2 / c 6 1 m 5.5.1 voltage down detection interrupt if the d40 bit in the d4int register is set to 1 (voltage down detection interrupt enabled), the voltage down detection interrupt request is generated when the voltage applied to the vcc pin crosses the vdet4 voltage level. the voltage down detection interrupt shares the same interrupt vector with the watchdog timer interrupt and oscillation stop, re-oscillation detection interrupt. set the d41 bit in the d4int register to 1 (enabled) to use the voltage down detection interrupt to exit stop mode. the d42 bit in the d4int register is set to 1 as soon as the voltage applied to the vcc pin reaches vdet4 due to the voltage rise and voltage drop. when the d42 bit changes 0 to 1 , the voltage down detection interrupt request is generated. set the d42 bit to 0 by program. however, when the d41 bit is set to 1 and the microcomputer is in stop mode, the voltage down detection interrupt request is generated regardless of the d42 bit state if the voltage applied to the vcc pin is detected to be above vdet4. the microcomputer then exits stop mode. table 5.5.1.1 shows how the voltage down detection interrupt request is generated. the df1 to df0 bits in the d4int register determine the sampling period that detects the voltage applied to the vcc pin reaches vdet4. table 5.5.1.2 shows the sampling periods. cpu clock (mhz) df1 to df0=00 (cpu clock divided by 8) sampling period ( table 5.5.1.1 voltage down detection interrupt request generation conditions d41 bit vc27 bit operation mode d40 bit d42 bit cm02 bit vc13 bit normal operation mode (1) wait mode (2) stop mode (2) notes: 1. the status except the wait mode and stop mode is handled as the normal mode.(refer to 7. clock generating circuit ) 2. refer to 5.5.2 limitations on stop mode , 5.5.3 limitations on wait mode . 3. an interrupt request for voltage reduction is generated a sampling time after the value of the vc13 bit has changed. see the figure 5.5.1.2 voltage down detection interrupt generation circuit operation example for details. 0 to 1 (3) 1 0 1 1 0 1 to 0 (3) 0 to 1 (3) 1 to 0 (3) 0 to 1 0 to 1 0 to 1 0 to 1 1 C : 0 or 1 table 5.5.1.2 sampling periods
5. reset page 33 9 2 3 f o 7 0 0 2 , 5 1 . b e f 0 0 . 2 . v e r 0 0 2 0 - 2 0 2 0 b 9 0 j e r ) t 6 2 / c 6 1 m , b 6 2 / c 6 1 m , a 6 2 / c 6 1 m ( p u o r g a 6 2 / c 6 1 m figure 5.5.1.1 power supply down detection interrupt generation block figure 5.5.1.2 power supply down detection interrupt generation circuit operation example output of the digital filter (2 ) d42 bit in d4int registe r notes : 1. d40 bit in the d4int register is set to 1 (voltage down detection interrupt enabled). 2. output of the digital filter is shown in figure 5.5.1.1 . voltage down detection interrupt signal no voltage down detection interrupt signals are generated when the d42 bit is 1 . sampling vc13 bit in vcr1 register vc c sampling sampling sampling set to 0 by program (not detected) voltage down detection interrupt generation circuit watchdog timer interrupt signal vc27 vc13 voltage down detection circuit d4int clock(the clock with which it operates also in wait mode) d42 df1, df0 1/2 00b 01b 10b 11b 1/2 1/2 1/8 non-maskable interrupt signal oscillation stop, re-oscillation detection interrupt signal voltage down detection interrupt signal watchdog timer block this bit is set to 0 (not detected) by program. watchdog timer underflow signal d43 d41 cm02 wait instruction(wait mode) d40 vcc vref + - noise rejection (rejection range:200 ns) voltage down detection signal the voltage down detection signal becomes h when the vc27 bit is set to 0 (disabled) noise rejection circuit digital filter cm10 the d42 bit is set to 0 (not detected) by program. the vc27 bit is set to 0 (voltage down detect circuit disabled), the d42 bit is set to 0 .
5. reset page 34 9 2 3 f o 7 0 0 2 , 5 1 . b e f 0 0 . 2 . v e r 0 0 2 0 - 2 0 2 0 b 9 0 j e r ) t 6 2 / c 6 1 m , b 6 2 / c 6 1 m , a 6 2 / c 6 1 m ( p u o r g a 6 2 / c 6 1 m 5.5.2 limitations on exiting stop mode the voltage down detection interrupt is immediately generated and the microcomputer exits stop mode if the cm10 bit in the cm1 register is set to 1 under the conditions below. ? the vc27 bit in the vcr2 register is set to 1 (voltage down detection circuit enabled), ? the d40 bit in the d4int register is set to 1 (voltage down detection interrupt enabled), ? the d41 bit in the d4int register is set to 1 (voltage down detection interrupt is used to exit stop mode), and ? the voltage applied to the vcc pin is higher than vdet4 (the vc13 bit in the vcr1 register is 1 ) if the microcomputer is set to enter stop mode when the voltage applied to the vcc pin drops below vdet4 and to exit stop mode when the voltage applied rises to vdet4 or above, set the cm10 bit to 1 when vc13 bit is 0 (vcc < vdet4). 5.5.3 limitations on exiting wait mode the voltage down detection interrupt is immediately generated and the microcomputer exits wait mode if wait instruction is executed under the conditions below. ? the cm02 bit in the cm0 register is set to 1 (stop peripheral function clock), ? the vc27 bit in the vcr2 register is set to 1 (voltage down detection circuit enabled), ? the d40 bit in the d4int register is set to 1 (voltage down detection interrupt enabled), ? the d41 bit in the d4int register is set to 1 (voltage down detection interrupt is used to exit wait mode), and ? the voltage applied to the vcc pin is higher than vdet4 (the vc13 bit in the vcr1 register is 1 ) if the microcomputer is set to enter wait mode when the voltage applied to the vcc pin drops below vdet4 and to exit wait mode when the voltage applied rises to vdet4 or above, perform wait instruc- tion when vc13 bit is 0 (vcc < vdet4).
6. processor mode page 35 9 2 3 f o 7 0 0 2 , 5 1 . b e f 0 0 . 2 . v e r 0 0 2 0 - 2 0 2 0 b 9 0 j e r ) t 6 2 / c 6 1 m , b 6 2 / c 6 1 m , a 6 2 / c 6 1 m ( p u o r g a 6 2 / c 6 1 m 6. processor mode the microcomputer supports single-chip mode only. figures 6.1 and 6.2 show the associated registers. figure 6.1 pm0 register, pm1 register processor mode register 0 (1) symbol address after reset pm0 0004 16 00 16 bit name function bit symbol rw b7 b6 b5 b4 b3 b2 b1 b0 the microcomputer is reset when this bit is set to "1". when read, its content is "0". software reset bit pm03 rw rw rw notes: 1. rewrite the pm0 register after the prc1 bit in the prcr register is set to "1" (write enable). set to "0" (b2-b0) reserved bit set to "0" (b7-b4) reserved bit 000 0 00 0 processor mode register 1 (1) symbol address after reset pm1 0005 16 00001000 2 bit name function bit symbol rw b7 b6 b5 b4 b3 b2 b1 b0 flash data block access bit (2) 0: disabled 1: enabled (3) pm10 rw pm17 wait bit (5) 0 : no wait state 1 : wait state (1 wait) 0 : watchdog timer interrupt 1 : watchdog timer reset (4) watchdog timer function select bit pm12 rw rw rw rw rw notes: 1. rewrite the pm1 register after the prc1 bit in the prcr register is set to "1" (write enable). 2. to access the two 2k-byte data spaces in data block a and data block b, set the pm10 bit to "1". the pm10 bit is not available in mask version. 3. when the fmr01 bit in the fmr0 register is set to "1" (enables cpu rewrite mode), the pm10 bit is automatically set to "1". 4. set the pm12 bit to "1" by program. (writing "0" by program has no effect) 5. when the pm17 bit is set to "1" (wait state), one wait is inserted when accessing the internal ram or the internal rom. set to "0" (b1) reserved bit set to "1" reserved bit set to "0" (b6-b4) reserved bit (b3) 0 1 0 00
6. processor mode page 36 9 2 3 f o 7 0 0 2 , 5 1 . b e f 0 0 . 2 . v e r 0 0 2 0 - 2 0 2 0 b 9 0 j e r ) t 6 2 / c 6 1 m , b 6 2 / c 6 1 m , a 6 2 / c 6 1 m ( p u o r g a 6 2 / c 6 1 m figure 6.2 pm2 register function bit symbol bit name processeor mode register 2 (1) symbol address after reset pm2 001e 16 xxx00000 2 rw b7 b6 b5 b4 b3 b2 b1 b0 pm20 0 pm21 system clock protective bit (3,4) rw rw rw (b7-b5) pm22 pm24 (b3) reserved bit set to 0 rw rw notes: 1. write to this register after setting the prc1 bit in the prcr register to 1 (write enable). 2. the pm20 bit become effective when plc07 bit in the plc0 register is set to "1" (pll on). change the pm20 bit when the plc07 bit is set to "0" (pll off). set the pm20 bit to "0" (2 waits) when pll clock > 16 mhz. 3. once this bit is set to 1 , it cannot be set to 0 by program. 4. writing to the following bits has no effect when the pm21 bit is set to 1 : cm02 bit in the cm0 register cm05 bit in the cm0 register (main clock is not halted) cm07 bit in the cm0 register (cpu clock source does not change) cm10 bit in the cm1 register (stop mode is not entered) cm11 bit in the cm1 register (cpu clock source does not change) cm20 bit in the cm2 register (oscillation stop, re-oscillation detection function settings do not change) all bits in the plc0 register (pll frequency synthesizer setting do not change) when the pm21 bit is set to "1", do not execute the wait instruction. 5. setting the pm22 bit to 1 results in the following conditions: - the on-chip oscillator continues oscillating even if the cm21 bit in the cm2 register is set to "0" (main clock or pll clock) (system clock of count source selected by the cm21 bit is valid) - the on-chip oscillator starts oscillating, and the on-chip oscillator clock becomes the watchdog timer count source. - the cm10 bit in the cm1 register is disabled against write. (writing a 1 has no effect, nor is stop mode entered) - the watchdog timer does not stop in wait mode. 6. for nmi function, the pm24 bit must be set to 1 (nmi function). once this bit is set to 1 , it cannot be cleared to 0 by program. 7. sd input is valid regardless of the pm24 setting. specifying wait when accessing sfr during pll operation (2) 0: 2 wait 1: 1 wait wdt count source protective bit (3,5) p85/nmi configuration bit (6,7) 0: p8 5 function (nmi disable) 1: nmi function 0: cpu clock is used for the watchdog timer count source 1: on-chip oscillator clock is used for the watchdog timer count source 0: clock is protected by prcr register 1: clock modification disabled nothing is assigned. when write, set to 0 . when read,its content is indeterminate
6. processor mode page 37 9 2 3 f o 7 0 0 2 , 5 1 . b e f 0 0 . 2 . v e r 0 0 2 0 - 2 0 2 0 b 9 0 j e r ) t 6 2 / c 6 1 m , b 6 2 / c 6 1 m , a 6 2 / c 6 1 m ( p u o r g a 6 2 / c 6 1 m the internal bus consists of cpu bus, memory bus, and peripheral bus. bus interface unit (biu) is used to interfere with cpu, rom/ram, and perpheral functions by controling cpu bus, memory bus, and periph- eral bus. figure 6.3 shows the block diagram of the internal bus. figure 6.3 bus block diagram the number of bus cycle varies by the internal bus. table 6.1 lists the accessible area and bus cycle. table 6.1 accessible area and bus cycle accessible area bus cycle sfr pm20 bit = 0 (2 waits) 3 cpu clock cycles pm20 bit = 1 (1 wait) 2 cpu clock cycles rom/ram pm17 bit = 0 (no wait) 1 cpu clock cycle pm17 bit = 1 (1 wait) 2 cpu clock cycles cpu rom biu i/o cp u address bus memory data bus periphral data bus dmac memory address bus peripheral address bus timer wdt serial i/o adc peripheral function cpu clock ram cpu data bus peripheral function . . . . clock generation circuit s f r
7. clock generation circuit page 38 9 2 3 f o 7 0 0 2 , 5 1 . b e f 0 0 . 2 . v e r 0 0 2 0 - 2 0 2 0 b 9 0 j e r ) t 6 2 / c 6 1 m , b 6 2 / c 6 1 m , a 6 2 / c 6 1 m ( p u o r g a 6 2 / c 6 1 m 7. clock generation circuit the clock generation circuit contains four oscillator circuits as follows: (1) main clock oscillation circuit (2) sub clock oscillation circuit (3) on-chip oscillator (available at reset, oscillation stop detect function) (4) pll frequency synthesizer table 7.1 lists the clock generation circuit specifications. figure 7.1 shows the clock generation circuit. figures 7.2 to 7.6 show the clock-related registers. table 7.1. clock generation circuit specifications ? ? ? ? ? ? ? ? ? ? ? ? ? ?
7. clock generation circuit page 39 9 2 3 f o 7 0 0 2 , 5 1 . b e f 0 0 . 2 . v e r 0 0 2 0 - 2 0 2 0 b 9 0 j e r ) t 6 2 / c 6 1 m , b 6 2 / c 6 1 m , a 6 2 / c 6 1 m ( p u o r g a 6 2 / c 6 1 m f c3 2 cm00, cm01, cm02, cm04, cm05, cm06, cm07: cm0 register bits cm10, cm11, cm16, cm17: cm1 register bits pclk0, pclk1, pclk5: pclkr register bits cm21, cm27 : cm2 register bits 1/32 main clock generating circuit f c cm02 cm04 cm10=1(stop mode) q s r wait instruction cm05 q s r nmi interrupt request level judgment output reset software reset f c cpu clock cm07 = 0 cm07 = 1 a d 1/2 1/2 1/2 1/2 cm06=0 cm17-cm16=00 2 cm06=0 cm17-cm16=01 2 cm06=0 cm17-cm16=10 2 cm06=1 cm06=0 cm17-cm16=11 2 d a details of divider sub-clock generating circuit x cin x cout x out x in f 8 f 32 c b b 1/2 c f 32sio f 8s i o f ad f 1 e e 1/2 1/4 1/8 1/16 1/32 p c lk 0 = 1 pll frequency s y nt h es i z e r 0 1 c m21= 1 c m11 c m21= 0 pl l cloc k sub-clock o n-chi p oscillato r cloc k p c lk 0 = 0 f 2 f 1 s i o p c lk1=1 p c lk1= 0 f 2 s i o main clock oscillation stop, re- oscillation detection circuit d4int clock clk out i/o ports pclk5=0,cm01-cm00=00 2 pclk5=0,cm01-cm00=01 2 pclk5=1, cm01-cm00=00 2 pclk5=0, cm01-cm00=10 2 pclk5=0, cm01-cm00=11 2 cm21 bclk figure 7.1. clock generation circuit phase comparator charge pump voltage control oscillator (vco) pll clock main clock 1/2 programmable counter internal low- pass filter pll frequency synthesizer pulse generation circuit for clock edge detection and charge, discharge control charge, discharge circuit reset generating circuit oscillation stop, re-oscillation detection interrupt generating circuit main clock oscillation stop detection reset cm27=0 cm21 switch signal oscillation stop, re-oscillation detection signal oscillation stop, re-oscillation detection circuit cm27=1 1/2 1/2 1/2 rocr3-rocr2=11 2 on-chip oscillator clock 1/8 1/4 1/2 rocr3-rocr2=10 2 rocr3-rocr2=01 2 rocr1-rocr0=00 2 f 1(roc) f 2(roc) f 3(roc) rocr1-rocr0=01 2 rocr1-rocr0=11 2 on-chip oscillator
7. clock generation circuit page 40 9 2 3 f o 7 0 0 2 , 5 1 . b e f 0 0 . 2 . v e r 0 0 2 0 - 2 0 2 0 b 9 0 j e r ) t 6 2 / c 6 1 m , b 6 2 / c 6 1 m , a 6 2 / c 6 1 m ( p u o r g a 6 2 / c 6 1 m figure 7.2. cm0 register system clock control register 0 (1) symbol address after reset cm0 0006 16 01001000 2 (m16c/26a, m16c/26b) bit name function bit symbol b7 b6 b5 b4 b3 b2 b1 b0 cm07 cm05 cm04 cm03 cm02 cm06 wait peripheral function clock stop bit (10) 1 : stop peripheral function clock in wait mode (8) x cin -x cout drive capacity select bit (2) 1 : high main clock stop bit (3, 10, 12, 13) 0 : on 1 : off (4, 5) main clock division select bit 0 (7, 13, 14) 0 : cm16 and cm17 valid 1 : division by 8 mode system clock select bit (6, 10, 11, 12) 0 : main clock, pll clock, or on-chip oscillator clock 1 : sub-clock rw port x c select bit (2) rw rw rw rw rw rw rw refer to table 7.5.3.1 function of the clkout pin 01101000 2 (m16c/26t) cm00 cm01 clock output function select bit 0 : do not stop peripheral function clock in wait mode 0 : low 0 : i/o port p8 6 , p8 7 1 : x cin -x cout generation function (9) rw notes: 1. write to this register after setting the prc0 bit in the prcr register to "1" (write enable). 2. the cm03 bit is set to "1" (high) when the cm04 bit is set to "0" (i/o port) or the microcomputer goes to a stop mode. 3. this bit is provided to stop the main clock when the low power dissipation mode or on-chip oscillator low power dissipation mode is selected. this bit cannot be used for detection as to whether the main clock stopped or not. to stop the main clock, t he following setting is required: (1) set the cm07 bit to "1" (sub-clock select) or the cm21 bit in the cm2 register to "1" (on-chip oscillator select) with the sub- clock stably oscillating. (2) set the cm20 bit in cm2 register to "0" (oscillation stop, re-oscillation detection function disabled). (3) set the cm05 bit to "1" (stop). 4. during external clock input, only the clock oscillation buffer is turned off and clock input is accepted. 5. when cm05 bit is set to "1", the x out pin goes "h". furthermore, because the internal feedback resistor remains connected, the x in pin is pulled "h" to the same level as x out via the feedback resistor. 6. after setting the cm04 bit to "1" (x cin -x cout oscillator function), wait until the sub-clock oscillates stably before switching the cm07 bit from "0" to "1" (sub-clock). 7. when entering stop mode from high or middle speed mode, on-chip oscillator mode or on-chip oscillator low power mode, the cm06 bit is set to "1" (divide-by-8 mode). 8. the f c32 clock does not stop. during low speed or low power dissipation mode, do not set this bit to "1" (peripheral clock turned off when in wait mode). 9. to use a sub-clock, set this bit to "1". also make sure ports p8 6 and p8 7 are directed for input, with no pull-ups. 10. when the pm21 bit of pm2 register is set to "1" (clock modification disable), writing to the cm02, cm05, and cm07 bits has no effect. 11. if the pm21 bit needs to be set to "1", set the cm07 bit to "0"(main clock) before setting it. 12. to use the main clock as the clock source for the cpu clock, follow the procedure below. (1) set the cm05 bit to "0" (oscillate). (2) wait until td(m-l) elapses or the main clock oscillation stabilizes, whichever is longer. (3) set the cm11, cm21 and cm07 bits all to "0". 13. when the cm21 bit is set to "0" (on-chip oscillaor turned off) and the cm05 bit is set to "1" (main clock turned off), the cm06 bit is fixed to "1" (divide-by-8 mode) and the cm15 bit is fixed to "1" (drive capability high). 14. to return from on-chip oscillator mode to high-speed or middle-speed mode set the cm06 and cm15 bits both to "1".
7. clock generation circuit page 41 9 2 3 f o 7 0 0 2 , 5 1 . b e f 0 0 . 2 . v e r 0 0 2 0 - 2 0 2 0 b 9 0 j e r ) t 6 2 / c 6 1 m , b 6 2 / c 6 1 m , a 6 2 / c 6 1 m ( p u o r g a 6 2 / c 6 1 m system clock control register 1 (1) symbol address after reset cm1 0007 16 00100000 2 bit name function bit symbol b7 b6 b5 b4 b3 b2 b1 b0 cm10 all clock stop control bit (4, 6) 0 : clock on 1 : all clocks off (stop mode) cm15 x in -x out drive capacity select bit (2) 0 : low 1 : hig h rw cm16 cm17 reserved bit must set to 0 main clock division select bits (3) 0 0 : no division mode 0 1 : division by 2 mode 1 0 : division by 4 mode 1 1 : division by 16 mode b7 b6 0 00 cm11 system clock select bit 1 (6, 7) 0 : main clock 1 : pll clock (5) rw rw rw rw rw rw (b4-b2) notes: 1. write to this register after setting the prc0 bit in the prcr register to 1 (write enable). 2. when entering stop mode from high or middle speed mode, or when the cm05 bit is set to 1 (main clock turned off) in low speed mode, the cm15 bit is set to 1 (drive capability high). 3. effective when the cm06 bit is 0 (cm16 and cm17 bits enable). 4. if the cm10 bit is 1 (stop mode), x out goes h and the internal feedback resistor is disconnected. the x cin and x cout pins are placed in the high-impedance state. when the cm11 bit is set to 1 (pll clock), or the cm20 bit in the cm2 register is set to 1 (oscillation stop, re-oscillation detection function enabled), do not set the cm10 bit to 1 . 5. after setting the plc07 bit in the plc0 register to 1 (pll operation), wait until tsu (pll) elapses before setting the cm11 bit to 1 (pll clock). 6. when the pm21 bit in the pm2 register is set to 1 (clock modification disable), writing to the cm10, cm011 bits has no effect. when the pm22 bit in the pm2 register is set to 1 (watchdog timer count source is on-chip oscillator clock), writing to the cm10 bit has no effect. 7. effective when cm07 bit is 0 and cm21 bit is 0 . figure 7.3. cm1 register figure 7.4. rocr register b7 b6 b5 b4 b3 b2 b1 b0 rw rocr0 rocr1 on-chip oscillator control register (1) symbol address after reset rocr 025c 16 x0000101 2 bit name function bit symbol frequency select bits rw rw reserved bit 00 0 0 0: f 1 (roc) 0 1: f 2 (roc) 1 0: do not set to this value 1 1: f 3 (roc) b1 b0 rocr2 rocr3 divider select bits rw rw 0 0: do not set to this value 0 1: divide by 2 1 0: divide by 4 1 1: divide by 8 b3 b2 note: 1. write to this register after setting the prc0 bit in the prcr register to 1 (write enable). (b6-b4) set to 0 nothing is assigned. when write, set to 0. when read, its content is undefined (b7) rw
7. clock generation circuit page 42 9 2 3 f o 7 0 0 2 , 5 1 . b e f 0 0 . 2 . v e r 0 0 2 0 - 2 0 2 0 b 9 0 j e r ) t 6 2 / c 6 1 m , b 6 2 / c 6 1 m , a 6 2 / c 6 1 m ( p u o r g a 6 2 / c 6 1 m b7 b6 b5 b4 b3 b2 b1 b0 rw cm20 cm2 1 oscillation stop detection register (1) symbol address after reset cm2 000c 16 0x000010 2 (11) bit name function bit symbol system clock select bit 2 (2, 3, 6, 8, 11, 12 ) 0: oscillation stop, re-oscillation detection function disabled 1: oscillation stop, re-oscillation detection function enabled 0: main clock or pll clock 1: on-chip oscillator clock (on-chip oscillator oscillating) oscillation stop, re- oscillation detection bit (7, 9, 10, 11) cm2 2 cm2 3 oscillation stop, re- oscillation detection flag 0: main clock stop or re-oscillation not detected 1: main clock stop or re-oscillation detected 0: main clock oscillating 1: main clock not oscillating x in monitor flag (4) cm27 0: oscillation stop detection reset 1: oscillation stop, re-oscillation detection interrupt nothing is assigned. when write, set to 0 . when read, its content is indeterminate. operation select bit (when an oscillation stop, re-oscillation is detected) (11) rw rw rw rw ro (b6) (5) reserved bit (b5-b4) must set to 0 rw 00 notes: 1. write to this register after setting the prc0 bit in the prcr register to 1 (write enable). 2. when the cm20 bit is set to 1 (oscillation stop, re-oscillation detection function enabled), the cm27 bit is set to 1 (oscillation stop, re-oscillation detection interrupt), and the cpu clock source is the main clock, the cm21 bit isautomatically set to 1 (on-chip oscillator clock) if the main clock stop is detected. 3. if the cm20 bit is set to 1 and the cm23 bit is set to 1 (main clock not oscillating), do not set the cm21 bit to 0 . 4. this flag is set to 1 when the main clock is detected to have stopped or when the main clock is detected to haverestarted oscillating. when this flag changes state from 0 to 1 , an oscillation stop, reoscillation detection interrupt isgenerated. use this flag in an interrupt routine to discriminate the causes of interrupts between theoscillation stop,reoscillation detection interrupts and the watchdog timer interrupt. the flag is cleared to 0 by writing a 0 in aprogram. (writing a 1 has no effect. nor is it cleared to 0 by an oscillation stop or an oscillation restart detectiointerrupt request acknowledged.) if when the cm22 bit is set to "1" an oscillation stop or an oscillation restart is detected, no oscillation stop, reoscillation detection interrupts are generated. 5. read the cm23 bit in an oscillation stop, re-oscillation detection interrupt handling routine to determine the main clockstatus. 6. effective when the cm07 bit in the cm0 register is set to 0 . 7. when the pm21 bit in the pm2 register is 1 (clock modification disabled), writing to the cm20 bit has no effect. 8. when the cm20 bit is set to 1 (oscillation stop, re-oscillation detection function enabled), the cm27 bit is set to 1 (oscillation stop, re-oscillation detection interrupt), and the cm11 bit is set to 1 (the cpu clock source is pll clock), the cm21 bit remains unchanged even when main clock stop is detected. if the cm22 bit is set to 0 under these conditions, oscillation stop, re-oscillation detection interrupt occur at main clock stop detection; it is, therefore, necessary to set the cm21 bit to 1 (on-chip oscillator clock) inside the interrupt routine. 9. set the cm20 bit to 0 (disable) before entering stop mode. after exiting stop mode, set the cm20 bit back to "1 (enable). 10. set the cm20 bit to 0 (disable) before setting the cm05 bit in the cm0 register. 11. the cm20, cm21 and cm27 bits do not change at oscillation stop detection reset. 12. when the cm21 bit is set to "0" (on-chip oscillator turned off) and the cm05 bit is set to "1" (main clock turned off), the cm06 bit is fixed to 1 (divide-by-8 mode) and the cm15 bit is fixed to 1 (drive capability high). figure 7.5. cm2 register
7. clock generation circuit page 43 9 2 3 f o 7 0 0 2 , 5 1 . b e f 0 0 . 2 . v e r 0 0 2 0 - 2 0 2 0 b 9 0 j e r ) t 6 2 / c 6 1 m , b 6 2 / c 6 1 m , a 6 2 / c 6 1 m ( p u o r g a 6 2 / c 6 1 m figure 7.6. pclkr register and pm2 register function bit symbol bit name peripheral clock select register (1) symbol address after reset pclkr 025e 16 00000011 2 rw b7 b6 b5 b4 b3 b2 b1 b0 pclk0 0: f 2 1: f 1 000 reserved bit set to 0 note: 1. write to this register after setting the prc0 bit in prcr register to 1 (write enable). 00 pclk1 0: f 2 sio 1: f 1 sio rw rw rw (b4-b2) reserved bit set to 0 rw (b7-b6) rw pclk5 refer to table 7.5.3.1 clock output function expansion select bit timers a, b clock select bit (clock source for the timers a, b, the timer s, the dead timer, si/o3, si/o4 and multi-master i 2 c bus) si/o clock select bit (clock source for uart0 to uart2) notes: 1. write to this register after setting the prc1 bit in the prcr register to 1 (write enable). 2. the pm20 bit becomes effective when plc07 bit in the plc0 register is set to 1 (pll on). change the pm20 bit when the plc07 bit is set to 0 (pll off). set the pm20 bit to 0 (2 waits) when pll clock > 16mhz. 3. once this bit is set to 1, it cannot be cleared to 0 by program. 4. writting to the following bits has no effect when the pm21 bit is set to 1: cm02 bit in the cm0 register cm05 bit in the cm0 register (main clock is not halted) cm07 bit in the cm0 register (cpu clock source does not change) cm10 bit in the cm1 register (stop mode is not entered) cm11 bit in the cm1 register (cpu clock source does not change) cm20 bit in the cm2 register (oscillation stop, re-oscillation detection function settings do not change) all bits in the plc0 register (pll frequency synthesizer setting do not change) do not execute wait instruction when the pm21 bit is set to 1. 5. setting the pm22 bit to 1 results in the following conditions: ? the on-chip oscillator continues oscillating even if the cm21 bit in the cm2 register is set to "0" (main clock or pll clock) (system clock of count source selected by the cm21 bit is valid) ? the on-chip oscillator starts oscillating, and the on-chip oscillator clock becomes the watchdog timer count source. ? the cm10 bit in the cm1 register cannnot be written. (writing 1 has no effect, stop mode is not entered.) ? the watchdog timer does not stop in wait mode. 6. for nmi function, the pm24 bit must be set to 1(nmi function). once this bit is set to 1, it cannot be set to 0 by program. 7. sd input is valid regardless of the pm24 setting. function bit symbol bit name processeor mode register 2 (1) symbol address after reset pm2 001e 16 xxx00000 2 rw b7 b6 b5 b4 b3 b2 b1 b0 pm20 0 pm21 rw rw rw (b7-b5) pm22 pm24 (b3) reserved bit set to 0 rw rw nothing is assigned. when write, set to 0. when read, thecontent is undefined 0: cpu clock is used for the watchdog timer count source 1: on-chip oscillator clock is used for the watchdog timer count source 0: 2 waits 1: 1 wait specifying wait when accessing sfr (2) system clock protective bit (3,4) wdt count source protective bit (3,5) 0: clock is protected by prcr register 1: clock modification disabled p8 5 /nmi configuration bit(6,7) 0: p 8 5 function (nmi disabled) 1: nmi function
7. clock generation circuit page 44 9 2 3 f o 7 0 0 2 , 5 1 . b e f 0 0 . 2 . v e r 0 0 2 0 - 2 0 2 0 b 9 0 j e r ) t 6 2 / c 6 1 m , b 6 2 / c 6 1 m , a 6 2 / c 6 1 m ( p u o r g a 6 2 / c 6 1 m figure 7.7. plc0 register plc00 plc01 plc02 plc07 (3) (4) function pll control register 0 (1, 2) pll multiplying factor select bit nothing is assigned. when write, set to "0". when read, its content is indeterminate. reserved bit operation enable bit 0 0 0: 0 0 1: multiply by 2 0 1 0: multiply by 4 0 1 1: 1 0 0: 1 0 1: 1 1 0: 1 1 1: 0: pll off 1: pll on must set to "1" bit name bit symbol symbol address after reset plc0 001c 16 0001 x010 2 rw b1b0 b2 reserved bit must set to "0" do not set rw rw rw rw rw rw do not set (b4) (b6-b5) (b3) b7 b6 b5 b4 b3 b2 b1 b0 0 1 0 notes: 1. write to this register after setting the prc0 bit in the prcr register to "1" (write enable). 2. when the pm21 bit in the pm2 register is "1" (clock modification disable), writing to this register has no effect. 3. these three bits can only be modified when the plc07 bit is set to "0" (pll turned off). the value once written to this bit cannot be modified. 4. before setting this bit to "1" , set the cm07 bit to "0" (main clock), set the cm17 and cm16 bits to "00 2 " (main clock undivided mode), and set the cm06 bit to "0" (cm16 and cm17 bits enable).
7. clock generation circuit page 45 9 2 3 f o 7 0 0 2 , 5 1 . b e f 0 0 . 2 . v e r 0 0 2 0 - 2 0 2 0 b 9 0 j e r ) t 6 2 / c 6 1 m , b 6 2 / c 6 1 m , a 6 2 / c 6 1 m ( p u o r g a 6 2 / c 6 1 m figure 7.1.1. examples of main clock connection circuit the following describes the clocks generated by the clock generation circuit. 7.1 main clock the main clock is generated by the main clock oscillation circuit. this clock is used as the clock source for the cpu and peripheral function clocks. the main clock oscillator circuit is configured by connecting a resonator between the x in and x out pins. the main clock oscillator circuit contains a feedback resistor, which is disconnected from the oscillator circuit during stop mode in order to reduce the amount of power consumed in the chip. the main clock oscillator circuit may also be configured by feeding an externally generated clock to the x in pin. figure 7.1.1 shows the examples of main clock connection circuit. the main clock after reset oscillates in the m16c/26a and m16c/26b, but stop in the m16c/26t. the power consumption in the chip can be reduced by setting the cm05 bit in the cm0 register to 1 (main clock oscillator circuit turned off) after switching the clock source for the cpu clock to a sub clock or on-chip oscillator clock. in this case, x out goes h . furthermore, because the internal feedback resistor remains on, x in is pulled h to x out via the feedback resistor. during stop mode, all clocks including the main clock are turned off. refer to 7.6 power control . if the main clock is not used, it is recommended to connect the xin pin to vcc to reduce power consump- tion during reset. external clock x in x out open v cc v ss note: 1. insert a damping resistor if required. resistance value varies depending on the oscillator setting. use resistance value recommended by the oscillator manufacturer. if the oscillator manufacturer recommends that a feedback resistor be added to the chip externally, insert a feedback resistor between x in and x out . 2. the external clock should not be stopped when it is connected to the x in pin and the main clock is selected as the cpu clock. oscillator rd (1) c in c out x in x out mcu (built-in feedback resistor) mcu (built-in feedback resistor) v ss
7. clock generation circuit page 46 9 2 3 f o 7 0 0 2 , 5 1 . b e f 0 0 . 2 . v e r 0 0 2 0 - 2 0 2 0 b 9 0 j e r ) t 6 2 / c 6 1 m , b 6 2 / c 6 1 m , a 6 2 / c 6 1 m ( p u o r g a 6 2 / c 6 1 m figure 7.2.1. examples of sub clock connection circuit 7.2 sub clock the sub clock is generated by the sub clock oscillation circuit. this clock is used as the clock source for the cpu clock, as well as the timer a and timer b count sources. the sub clock oscillator circuit is configured by connecting a crystal resonator between the x cin and x cout pins. the sub clock oscillator circuit contains a feedback resistor, which is disconnected from the oscillator circuit during stop mode in order to reduce the amount of power consumed in the chip. the sub clock oscillator circuit may also be configured by feeding an externally generated clock to the x cin pin. figure 7.2.1 shows the examples of sub clock connection circuit. after reset, the sub clock is turned off. at this time, the feedback resistor is disconnected from the oscillator circuit. to use the sub clock for the cpu clock, set the cm07 bit in the cm0 register to 1 (sub clock) after the sub clock becomes oscillating stably. during stop mode, all clocks including the sub clock are turned off. refer to 7.6 power control . external clock x c in x c out open v cc v ss note: 1. place a damping resistor if required. resistance values vary depending on the oscillator setting. use values recommended by each oscillator manufacturer. place a feedback resistor between x cin and x cout if the oscillator manufacturer recommends placing the resistor externally. oscillator r c d (1) c cin c cout x cin x cout mcu (built-in feedback resistor) mcu (built-in feedback resistor) v ss
7. clock generation circuit page 47 9 2 3 f o 7 0 0 2 , 5 1 . b e f 0 0 . 2 . v e r 0 0 2 0 - 2 0 2 0 b 9 0 j e r ) t 6 2 / c 6 1 m , b 6 2 / c 6 1 m , a 6 2 / c 6 1 m ( p u o r g a 6 2 / c 6 1 m 7.3 on-chip oscillator clock this clock is supplied by a on-chip oscillator. this clock is used as the clock source for the cpu and peripheral function clocks. in addition, if the pm22 bit in the pm2 register is 1 (on-chip oscillator clock for the watchdog timer count source), this clock is used as the count source for the watchdog timer (refer to 10.1 count source protective mode ). the on-chip oscillator clock after reset oscillates. the on-chip oscillator clock f 2(roc) divided by 16 is used for the cpu clock. it can also be turned off by setting the cm21 bit in the cm2 register to 0 (main clock or pll clock). if the main clock stops oscillating when the cm20 bit in the cm2 register is 1 (oscillation stop, re-oscillation detection function enabled) and the cm27 bit is 1 (oscillation stop, re-oscillation detection interrupt), the on-chip oscillator automatically starts operating, supplying the necessary clock for the micro- computer. 7.4 pll clock the pll clock is generated from the main clock by a pll frequency synthesizer. this clock is used as the clock source for the cpu and peripheral function clocks. after reset, the pll clock is turned off. the pll frequency synthesizer is activated by setting the plc07 bit to 1 (pll operation). when the pll clock is used as the clock source for the cpu clock, wait t su (pll) for the pll clock to be stable, and then set the cm11 bit in the cm1 register to 1 . before entering wait mode or stop mode, be sure to set the cm11 bit to 0 (cpu clock source is the main clock). furthermore, before entering stop mode, be sure to set the plc07 bit in the plc0 register to 0 (pll stops). figure 7.4.1 shows the procedure for using the pll clock as the clock source for the cpu. the pll clock frequency is determined by the equation below. pll clock frequency=f(x in ) x (multiplying factor set by the plc02 to plc00 bits in the plc0 register) (however, 10 mhz table 7.4.1. example for setting pll clock frequencies note: 1. 10 mhz
7. clock generation circuit page 48 9 2 3 f o 7 0 0 2 , 5 1 . b e f 0 0 . 2 . v e r 0 0 2 0 - 2 0 2 0 b 9 0 j e r ) t 6 2 / c 6 1 m , b 6 2 / c 6 1 m , a 6 2 / c 6 1 m ( p u o r g a 6 2 / c 6 1 m figure 7.4.1. procedure to use pll clock as cpu clock source start set the cm07 bit to 0 (main clock), the cm17 to cm16 bits to 00 2 (main clock undivided), and the cm06 bit to 0 (cm16 and cm17 bits enabled). (1) set the plc02 to plc00 bits (multiplying factor). (to select a 16 mhz < pll clock) set the pm20 bit to 0 (2-wait states). set the plc07 bit to 1 (pll operation). wait until the pll clock becomes stable (t su (pll)). set the cm11 bit to 1 (pll clock for the cpu clock source). end note: 1. pll operation mode can be entered from high speed mode.
7. clock generation circuit page 49 9 2 3 f o 7 0 0 2 , 5 1 . b e f 0 0 . 2 . v e r 0 0 2 0 - 2 0 2 0 b 9 0 j e r ) t 6 2 / c 6 1 m , b 6 2 / c 6 1 m , a 6 2 / c 6 1 m ( p u o r g a 6 2 / c 6 1 m 7.5 cpu clock and peripheral function clock the cpu clock is used to operate the cpu and peripheral function clocks are used to operate the periph- eral functions. 7.5.1 cpu clock this is the operating clock for the cpu and watchdog timer. the clock source for the cpu clock can be chosen to be the main clock, sub clock, on-chip oscillator clock or the pll clock. if the main clock or on-chip oscillator clock is selected as the clock source for the cpu clock, the selected clock source can be divided by 1 (undivided), 2, 4, 8 or 16 to produce the cpu clock. use the cm06 bit in cm0 register and the cm17 to cm16 bits in cm1 register to select the divide-by-n value. when the pll clock is selected as the clock source for the cpu clock, the cm06 bit should be set to 0 and the cm17 and cm16 bits to 00 2 (undivided). after reset, the on-chip oscillator clock divided by 16 provides the cpu clock. note that when entering stop mode from high or middle speed mode, on-chip oscillator mode or on-chip oscillator low power dissipation mode, or when the cm05 bit in the cm0 register is set to 1 (main clock turned off) in low-speed mode, the cm06 bit in the cm0 register is set to 1 (divide-by-8 mode). 7.5.2 peripheral function clock (f 1 , f 2 , f 8 , f 32 , f 1sio , f 2sio , f 8sio , f 32sio , f ad , f c32 ) these are operating clocks for the peripheral functions. of these, fi (i = 1, 2, 8, 32) and fi sio are derived from the main clock, pll clock or on-chip oscillator clock divided by i. the clock fi is used for timer a and timer b while fi sio is used for uart0 to uart2. additionally, the f1 and f2 clocks are also used for dead time timer. the f ad clock is produced from the main clock, pll clock or on-chip oscillator clock, and is used for the a/ d converter. when the wait instruction is executed after setting the cm02 bit in the cm0 register to 1 (peripheral function clock turned off during wait mode), or when the microcomputer is in low power dissipation mode, the fi, fi sio and f ad clocks are turned off. the f c32 clock is produced from the sub clock, and is used for timers a and b. this clock can only be used when the sub clock is on. 7.5.3 clockoutput function the f 1 , f 8 , f 32 or f c clock can be output from the clk out pin. use the pclk5 bit in the pclkr register and cm01 to cm00 bits in the cm0 register to select. table 7.5.3.1 shows the function of the clk out pin. table 7.5.3.1 the function of the clk out pin pc lk5 cm01 cm00 the function of the clk out pin 0 0 0 i/o port p9 0 001f c 010f 8 011f 32 100f 1 1 0 1 do not set 1 1 0 do not set 1 1 1 do not set
7. clock generation circuit page 50 9 2 3 f o 7 0 0 2 , 5 1 . b e f 0 0 . 2 . v e r 0 0 2 0 - 2 0 2 0 b 9 0 j e r ) t 6 2 / c 6 1 m , b 6 2 / c 6 1 m , a 6 2 / c 6 1 m ( p u o r g a 6 2 / c 6 1 m 7.6 power control there are three power control modes. for convenience sake, all modes other than wait and stop modes are referred to as normal operation mode here. 7.6.1 normal operation mode normal operation mode is further classified into seven modes. in normal operation mode, because the cpu clock and the peripheral function clocks both are on, the cpu and the peripheral functions are operating. power control is exercised by controlling the cpu clock frequency. the higher the cpu clock frequency, the greater the processing capability. the lower the cpu clock frequency, the smaller the power consumption in the chip. if the unnecessary oscillator circuits are turned off, the power consumption is further reduced. before the clock sources for the cpu clock can be switched over, the new clock source to which switched must be oscillating stably. if the new clock source is the main clock, sub clock or pll clock, allow a sufficient wait time in a program until it becomes oscillating stably. note that operation modes cannot be changed directly from low power dissipation mode to on-chip oscil- lator mode or on-chip oscillator low power dissipation mode. nor can operation modes be changed directly from on-chip oscillator mode or on-chip oscillator low power dissipation mode to low power dissi- pation mode. when the cpu clock source is changed from the on-chip oscillator to the main clock, change the opera- tion mode to the medium speed mode (divided by 8 mode) after the clock was divided by 8 (the cm06 bit in the cm0 register was set to 1 ) in the on-chip oscillator mode. 7.6.1.1 high-speed mode the main clock divided by 1 provides the cpu clock. if the sub clock is on, f c32 can be used as the count source for timers a and b. 7.6.1.2 pll operation mode the main clock multiplied by 2 or 4 provides the pll clock, and this pll clock serves as the cpu clock. if the sub clock is on, f c32 can be used as the count source for timers a and b. pll operation mode can be entered from high speed mode. if pll operation mode is to be changed to wait or stop mode, first go to high speed mode before changing. 7.6.1.3 medium-speed mode the main clock divided by 2, 4, 8 or 16 provides the cpu clock. if the sub clock is on, f c32 can be used as the count source for timers a and b. 7.6.1.4 low-speed mode the sub clock provides the cpu clock. the main clock is used as the clock source for the peripheral function clock when the cm21 bit is set to 0 (on-chip oscillator turned off), and the on-chip oscillator clock is used when the cm21 bit is set to 1 (on-chip oscillator oscillating). the f c32 clock can be used as the count source for timers a and b. 7.6.1.5 low power dissipation mode in this mode, the main clock is turned off after being placed in low speed mode. the sub clock provides the cpu clock. the f c32 clock can be used as the count source for timers a and b. peripheral function clock can use only f c32 . simultaneously when this mode is selected, the cm06 bit in the cm0 register becomes 1 (divided by 8 mode). in the low power dissipation mode, do not change the cm06 bit. consequently, the medium speed (divided by 8) mode is to be selected when the main clock is operated next.
7. clock generation circuit page 51 9 2 3 f o 7 0 0 2 , 5 1 . b e f 0 0 . 2 . v e r 0 0 2 0 - 2 0 2 0 b 9 0 j e r ) t 6 2 / c 6 1 m , b 6 2 / c 6 1 m , a 6 2 / c 6 1 m ( p u o r g a 6 2 / c 6 1 m 7.6.1.6 on-chip oscillator mode the selected on-chip oscillator clock divided by 1 (undivided), 2, 4, 8 or 16 provides the cpu clock. the on-chip oscillator clock is also the clock source for the peripheral function clocks. if the sub clock is on, f c32 can be used as the count source for timers a and b. the on-chip oscillator frequency can be selected rocr3 to rocr0 bits in rocr register. when the operation mode is returned to the high and medium speed modes, set the cm06 bit to 1 (divided by 8 mode). 7.6.1.7 on-chip oscillator low power dissipation mode the main clock is turned off after being placed in on-chip oscillator mode. the cpu clock can be selected as in the on-chip oscillator mode. the on-chip oscillator clock is the clock source for the peripheral function clocks. if the sub clock is on, f c32 can be used as the count source for timers a and b. 1(1) modes cm2 register cm21 cm1 register cm11 cm17, cm16 cm0 register cm07 cm06 cm05 cm04 pll operation mode 0100 2 00 high-speed mode 0 0 00 2 00 0 medium- speed mode 0001 2 00 0 0010 2 00 0 divided by 2 00 01 0 0011 2 00 0 low-speed mode 1 0 1 low power dissipation mode 11 on-chip oscillator mode (3) 1 divided by 4 divided by 8 divided by 16 on-chip oscillator low power dissipation mode 0 0 101 2 000 110 2 000 110 111 2 00 0 100 2 00 0 (2) divided by 2 divided by 4 divided by 8 divided by 16 divided by 1 1(1) (2) 1 0 notes: 1. when the cm05 bit is set to ??(main clock turned off) in low-speed mode, the mode goes to low power dissipation mode and cm06 bit is set to ??(divided by 8 mode) simultaneously. 2. the divide-by-n value can be selected the same way as in on-chip oscillator mode. 3. on-chip oscillator frequency can be any of those described in the section 7.6.1.6 on-chip oscillator mode . 7.6.2 wait mode in wait mode, the cpu clock is turned off, so are the cpu (because operated by the cpu clock) and the watchdog timer. however, if the pm22 bit in the pm2 register is 1 (on-chip oscillator clock for the watch- dog timer count source), the watchdog timer remains active. because the main clock, sub clock, on-chip oscillator clock and pll clock all are on, the peripheral functions using these clocks keep operating. 7.6.2.1 peripheral function clock stop function if the cm02 bit is 1 (peripheral function clocks turned off during wait mode), the f 1 , f 2 , f 8 , f 32 , f 1sio , f 8sio , f 32sio and f ad clocks are turned off when in wait mode, with the power consumption reduced that much. however, f c32 remains on. 7.6.2.2 entering wait mode the microcomputer is placed into wait mode by executing the wait instruction. when the cm11 bit is set to 1 (cpu clock source is the pll clock), be sure to clear the cm11 bit to 0 (cpu clock source is the main clock) before going to wait mode. the power consumption of the chip can be reduced by clearing the plc07 bit to 0 (pll stops). table 7.6.1.1. setting clock related bit and modes
7. clock generation circuit page 52 9 2 3 f o 7 0 0 2 , 5 1 . b e f 0 0 . 2 . v e r 0 0 2 0 - 2 0 2 0 b 9 0 j e r ) t 6 2 / c 6 1 m , b 6 2 / c 6 1 m , a 6 2 / c 6 1 m ( p u o r g a 6 2 / c 6 1 m interrupt cm02=0 cm02=1 nmi interrupt can be used serial i/o interrupt can be used when operating with internal or external clock can be used when operating with external clock key input interrupt can be used can be used a/d conversion interrupt can be used in one-shot mode or single sweep mode timer a interrupt can be used in all modes can be used in event counter mode or when the count source is fc32 timer b interrupt int interrupt can be used can be used (do not use) can be used table 7.6.2.4.1. interrupts to exit wait mode 7.6.2.3 pin status during wait mode table 7.6.2.3.1 lists pin status during wait mode. table 7.6.2.3.1 pin status in wait mode pin status i/o ports retains status before wait mode when fc selected does not stop clk out when f1, f8, f32 selected does not stop when the cm02 bit is set to 0 . retains status before wait mode when the cm02 bit is set to 1 . 7.6.2.4 exiting wait mode ______ the microcomputer is moved out of wait mode by a hardware reset, nmi interrupt or peripheral func- tion interrupt. ______ if the microcomputer is to be moved out of exit wait mode by a hardware reset or nmi interrupt, set the peripheral function interrupt priority ilvl2 to ilvl0 bits to 000 2 (interrupts disabled) before execut- ing the wait instruction. the peripheral function interrupts are affected by the cm02 bit. if the cm02 bit is set to 0 (peripheral function clocks not turned off during wait mode), all peripheral function interrupts can be used to exit wait mode. if the cm02 bit is set to 1 (peripheral function clocks turned off during wait mode), the peripheral functions using the peripheral function clocks stop operating, so that only the peripheral functions clocked by external signals can be used to exit wait mode. table 7.6.2.4.1 lists the interrupts to exit wait mode. if the microcomputer is to be moved out of wait mode by a peripheral function interrupt, set up the following before executing the wait instruction. 1. in the ilvl2 to ilvl0 bits in the interrupt control register, set the interrupt priority level of the periph eral function interrupt to be used to exit wait mode. also, for all of the peripheral function interrupts not used to exit wait mode, set the ilvl2 to ilvl0 bits to 000 2 (interrupt disable). 2. set the i flag to 1 . 3. enable the peripheral function whose interrupt is to be used to exit wait mode. in this case, when an interrupt request is generated and the cpu clock is thereby turned on, an interrupt routine is executed. the cpu clock turned on when exiting wait mode by a peripheral function interrupt is the same cpu clock that was on when the wait instruction was executed.
7. clock generation circuit page 53 9 2 3 f o 7 0 0 2 , 5 1 . b e f 0 0 . 2 . v e r 0 0 2 0 - 2 0 2 0 b 9 0 j e r ) t 6 2 / c 6 1 m , b 6 2 / c 6 1 m , a 6 2 / c 6 1 m ( p u o r g a 6 2 / c 6 1 m 7.6.3 stop mode in stop mode, all oscillator circuits are turned off, so are the cpu clock and the peripheral function clocks. therefore, the cpu and the peripheral functions clocked by these clocks stop operating. the least amount of power is consumed in this mode. if the voltage applied to vcc pin is v ram or more, the internal ram is retained. when applying 2.7 or less voltage to vcc pin, make sure vcc ? nmi interrupt ? key interrupt ______ ? int interrupt ? timer a, timer b interrupt (when counting external pulses in event counter mode) ? serial i/o interrupt (when external clock is selected) ? voltage down detection interrupt (refer to 5.5.1 voltage down detection interrupt for an operating condition) 7.6.3.1 entering stop mode the microcomputer is placed into stop mode by setting the cm10 bit in the cm1 register to 1 (all clocks turned off). at the same time, the cm06 bit in the cm0 register is set to 1 (divide-by-8 mode) and the cm15 bit in the cm10 register is set to 1 (main clock oscillator circuit drive capability high). before entering stop mode, set the cm20 bit to 0 (oscillation stop, re-oscillation detection function disable). also, if the cm11 bit is 1 (pll clock for the cpu clock source), set the cm11 bit to 0 (main clock for the cpu clock source) and the plc07 bit to 0 (pll turned off) before entering stop mode. 7.6.3.2 pin status during stop mode the i/o pins retain their status held just prior to entering stop mode. 7.6.3.3 exiting stop mode ______ the microcomputer is moved out of stop mode by a hardware reset, nmi interrupt or peripheral func- tion interrupt. ______ if the microcomputer is to be moved out of stop mode by a hardware reset or nmi interrupt, set the peripheral function interrupt priority ilvl2 to ilvl0 bits to 000 2 (interrupts disable) before setting the cm10 bit to 1 . if the microcomputer is to be moved out of stop mode by a peripheral function interrupt, set up the following before setting the cm10 bit to 1 . 1. in the ilvl2 to ilvl0 bits in the interrupt control register, set the interrupt priority level of the peripheral function interrupt to be used to exit stop mode. also, for all of the peripheral function interrupts not used to exit stop mode, set the ilvl2 to ilvl0 bits to 000 2 . 2. set the i flag to 1 . 3. enable the peripheral function whose interrupt is to be used to exit stop mode. in this case, when an interrupt request is generated and the cpu clock is thereby turned on, an interrupt service routine is executed. ______ which cpu clock will be used after exiting stop mode by a peripheral function or nmi interrupt is determined by the cpu clock that was on when the microcomputer was placed into stop mode as follows: if the cpu clock before entering stop mode was derived from the sub clock : sub clock if the cpu clock before entering stop mode was derived from the main clock : main clock divide-by-8 if the cpu clock before entering stop mode was derived from the on-chip oscillator clock: on-chip oscillator clock divide-by-8
7. clock generation circuit page 54 9 2 3 f o 7 0 0 2 , 5 1 . b e f 0 0 . 2 . v e r 0 0 2 0 - 2 0 2 0 b 9 0 j e r ) t 6 2 / c 6 1 m , b 6 2 / c 6 1 m , a 6 2 / c 6 1 m ( p u o r g a 6 2 / c 6 1 m figure 7.6.1. state transition to stop mode and wait mode figure 7.6.1 shows the state transition from normal operation mode to stop mode and wait mode. figure 7.6.1.1 shows the state transition in normal operation mode. table 7.6.1 shows a state transition matrix describing allowed transition and setting. the vertical line shows current state and horizontal line shows state after transition. reset medium-speed mode (divided-by-8 mode) high-speed, medium- speed mode stop mode wait mode interrupt interrupt low-speed mode stop mode interrupt wait mode interrupt stop mode all oscillators stopped interrupt wait mode wait instructio n interrupt cpu operation stopped pll operation mode (1, 2) wait mode interrupt cm10=1 (6 ) interrupt (4) stop mode wait instruction wait instruction wait instruction on-chip oscillator mode (selectable frequency) on-chip oscillator mode (f 2 (roc) /16) normal operation mode cm07=0 cm06=1 cm05=0 cm11=0 cm10=1 (5) on-chip oscillator low power dissipation mode stop mode interrupt (4 ) wait mode interrupt wait instructio n cm05, cm06, cm07: bits in the cm0 register cm10, cm11: bits in the cm1 register cm10=1 (6) cm10=1 (6) cm10=1 (6) cm10=1 (6) low power dissipation mode stop mode interrupt wait mode interrupt wait instruction cm21=1 cm21=0 cm10=1 (6 ) (7 ) : arrow shows mode can be changed. do not change mode to another mode when no arrow is shown. notes: 1. do not go directly from pll operation mode to wait or stop mode. 2. pll operation mode can be entered from high speed mode. similarly, pll operation mode can be changed back to high speed mode . 3. when the pm21 bit is set to 0 (system clock protective function unused). 4. the on-chip oscillator clock divided by 8 provides the cpu clock. 5. write to the cm0 register and cm1 register simultaneously by accessing in word units while cm21 bit is set to 0 (on-chip osc illator turned off). when the clock generated externally is input to the x cin pin, transit to stop mode with this process. 6. before entering stop mode, be sure to clear the cm20 bit in the cm2 register to 0 (oscillation stop and oscillation restart detection function disabled). 7. the cm06 bit is set to 1 (divide-by-8).
7. clock generation circuit page 55 9 2 3 f o 7 0 0 2 , 5 1 . b e f 0 0 . 2 . v e r 0 0 2 0 - 2 0 2 0 b 9 0 j e r ) t 6 2 / c 6 1 m , b 6 2 / c 6 1 m , a 6 2 / c 6 1 m ( p u o r g a 6 2 / c 6 1 m figure 7.6.1.1. state transition in normal mode cm04=0 cpu clock: f(pll) cm07=0 cm06=0 cm17=0 cm16=0 pll operation mode cm07=0 cm06=0 cm17=0 cm16=0 cm07=0 cm17=0 cm06=0 cm16=0 cm07=0 cm17=0 cm06=0 cm16=1 cm07=0 cm17=1 cm06=0 cm16=0 cm07=0 cm06=1 cm07=0 cm17=1 cm06=0 cm16=1 high-speed mode cm07=0 cm17=0 cm06=0 cm16=0 cm07=0 cm17=0 cm06=0 cm16=1 cm07=0 cm17=1 cm06=0 cm16=0 cm07=0 cm06=1 cm07=0 cm17=1 cm06=0 cm16=1 cm07=0 low-speed mode cm07=0 low power dissipation mode cm06=1 cm15=1 on-chip oscillator mode cpu clock on-chip oscillator mode cpu clock cpu clock on-chip oscillator low power dissipation mode cpu clock cm07=0 low-speed mode plc07=1 cm11=1 (5) plc07=0 cm11=0 (5) cm04=0 plc07=1 cm11=1 plc07=0 cm11=0 cm04=0 cm04=1 cm04=1 cm04=1 cm04=0 cm04=1 cm07=0 (2, 4) cm07=1 (3) cm05=1 (1, 7) cm05=0 cm21=0 (2, 6) cm21=1 cm21=0 (2, 6) cm21=1 cm21=0 cm21=1 main clock oscillation on-chip oscillator clock oscillation sub clock oscillation f(roc) f(roc)/2 f(roc)/4 f(roc)/8 f(roc)/16 f(roc) f(roc)/2 f(roc)/4 f(roc)/8 f(roc)/16 f(roc) f(roc)/2 f(roc)/4 f(roc)/8 f(roc)/16 f(roc) f(roc)/2 f(roc)/4 f(roc)/8 f(roc)/16 pll operation mode cpu clock: f(pll) cpu clock: f(x in ) high-speed mode middle-speed mode (divide by 2) cpu clock: f(x in )/2 cpu clock: f(x in )/4 cpu clock: f(x in )/8 cpu clock: f(x in )/16 cpu clock: f(x cin ) cpu clock: f(x cin ) cpu clock: f(x cin ) cm05=0 m0 m cm05=1 (1) cm05=1 (1) cm05=0 (5) (5) middle-speed mode (divide by 4) middle-speed mode (divide by 8) middle-speed mode (divide by 16) middle-speed mode (divide by 2) middle-speed mode (divide by 4) middle-speed mode (divide by 8) middle-speed mode (divide by 16) cpu clock: f(x in ) cpu clock: f(x in )/2 cpu clock: f(x in )/4 cpu clock: f(x in )/8 cpu clock: f(x in )/16 on-chip oscillator low power dissipation mode : arrow shows mode can be changed. do not change mode to another mode when no arrow is shown. notes: 1. avoid making a transition when the cm20 bit is set to 1 (oscillation stop, re-oscillation detection function enabled). set the cm20 bit to 0 (oscillation stop, re-oscillation detection function disabled) before transiting. 2. wait for the main clock oscillation stabilization time before switching over. set the cm15 bit in the cm1 register to 1 (drive capacity high) until main clock oscillation is stabilized. 3. switch clock after oscillation of sub-clock is sufficiently stable. 4. change bits cm17 and cm16 before changing the cm06 bit. 5. the pm20 bit in the pm2 register becomes effective when the plc07 bit in the plc0 register is set to 1 (pll on). chan ge the pm20 bit when the plc07 bit is set to 0 (pll off). set the pm20 bit to 0 (2 waits) when pll clock > 16mhz. 6. set the cm06 bit to 1 (division by 8 mode) before changing back the operation mode from on-chip oscillator mode to hig h- or middle-speed mode. 7. when the cm21 bit is set to 0 (on-chip oscillator turned off) and the cm05 bit is set to 1 (main clock turned off), th e cm06 bit is fixed to 1 (divide-by-8 mode) and the cm15 bit is fixed to 1 (drive capability high). cm07=1 (3) cm07=0 (4)
7. clock generation circuit page 56 9 2 3 f o 7 0 0 2 , 5 1 . b e f 0 0 . 2 . v e r 0 0 2 0 - 2 0 2 0 b 9 0 j e r ) t 6 2 / c 6 1 m , b 6 2 / c 6 1 m , a 6 2 / c 6 1 m ( p u o r g a 6 2 / c 6 1 m table 7.6.1. allowed transition and setting high-speed mode, middle-speed mode on-chip oscillator mode stop mode wait mode on-chip oscillator low power dissipation mode pll operation mode 2 low power dissipation mode low-speed mode 2 current state state after transition 8 -- (8) (18) 5 (9) 7 -- (10) (11) 1, 6 (12) 3 (14) 4 -- -- -- -- (13) 3 (15) -- -- -- -- -- -- (10) -- -- -- -- -- -- -- -- (18) (18) -- -- (16) 1 (17) (16) 1 (17) (16) 1 (17) (16) 1 (17) (16) 1 (17) -- -- (18) 5 (18) 5 (18) (18) (18) (18) (18) (1) (2) (3) (4) (5) (6) (7) (8) (9) (10) (11) (12) (13) (14) (15) (16) (17) (18) setting operation cm04 = 0 sub clock turned off cm04 = 1 sub clock oscillating cm06 = 0, cpu clock no division mode cm17 = 0 , cm16 = 0 cm06 = 0, cpu clock division by 2 mode cm17 = 0 , cm16 = 1 cm06 = 0, cpu clock division by 4 mode cm17 = 1 , cm16 = 0 cm06 = 1 cpu clock division by 8 mode cm06 = 0, cpu clock division by 16 mode cm17 = 1 , cm16 = 1 cm07 = 0 main clock, pll clock, or on-chip oscillator clock selected cm07 = 1 sub clock selected cm05 = 0 main clock oscillating cm05 = 1 main clock turned off plc07 = 0, cm11 = 0 main clock selected plc07 = 1, cm11 = 1 pll clock selected cm21 = 0 main clock or pll clock selected cm21 = 1 on-chip oscillator clock selected cm10 = 1 transition to stop mode wait instruction transition to wait mode hardware interrupt exit stop mode or wait mode notes: 1. avoid making a transition when the cm20 bit is set to 1 (oscillation stop, re-oscillation detection function enabled). set the cm20 bit to 0 (oscillation stop, re-oscillation detection function disabled) before transiting. 2. on-chip oscillator clock oscillates and stops in low-speed mode. in this mode, the on-chip oscillator can be used as pe ripheral function clock. sub clock oscillates and stops in pll operation mode. in this mode, sub clock can be used as a clock for the timers a and b. 3. pll operation mode can only be entered from and changed to high-speed mode. 4. set the cm06 bit to 1 (division by 8 mode) before transiting from on-chip oscillator mode to high- or middle-speed mode . 5. when exiting stop mode, the cm06 bit is set to 1 (division by 8 mode). 6. if the cm05 bit is set to 1 (main clock stop), then the cm06 bit is set to 1 (division by 8 mode). 7. a transition can be made only when sub clock is oscillating. 8. state transitions within the same mode (divide-by-n values changed or subclock oscillation turned on or off) are shown in the table below. --: cannot transit (11) 1 high-speed mode, middle-speed mode on-chip oscillator mode stop mode wait mode on-chip oscillator low power dissipation mode pll operation mode 2 low power dissipation mode low-speed mode 2 8 8 (3) (3) (3) (3) (4) (4) (4) (4) (5) (7) (7) (5) (5) (5) (7) (7) (6) (6) (6) (6) no division divided by 2 (3) (3) (3) (3) (4) (4) (4) (4) (5) (5) (5) (5) (7) (7) (7) (7) (6) (6) (6) (6) (1) (1) (1) (1) (1) (2) (2) (2) (2) (2) -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- sub clock oscillating sub clock turned off --: cannot transit divided by 4 divided by 8 divided by 16 no division divided by 2 divided by 4 divided by 8 divided by 16 no division divided by 4 sub clock oscillating sub clock turned off divided by 8 divided by 16 divided by 2 no division divided by 4 divided by 8 divided by 16 divided by 2 9. ( ) : setting method. refer to following table. cm04, cm05, cm06, cm07 : bits in the cm0 register cm10, cm11, cm16, cm17 : bits in the cm1 register cm20, cm21 : bits in the cm2 register plc07 : bit in the plc0 register (9) 7 (8)
7. clock generation circuit page 57 9 2 3 f o 7 0 0 2 , 5 1 . b e f 0 0 . 2 . v e r 0 0 2 0 - 2 0 2 0 b 9 0 j e r ) t 6 2 / c 6 1 m , b 6 2 / c 6 1 m , a 6 2 / c 6 1 m ( p u o r g a 6 2 / c 6 1 m 7.7 system clock protective function when the main clock is selected for the cpu clock source, this function protects the clock from modifica- tions in order to prevent the cpu clock from becoming halted by run-away. if the pm21 bit in the pm2 register is set to 1 (clock modification disabled), the following bits are protected against writes: ? cm02, cm05, and cm07 bits in cm0 register ? cm10, cm11 bits in cm1 register ? cm20 bit in cm2 register ? all bits in plc0 register before the system clock protective function can be used, the following register settings must be made while the cm05 bit in the cm0 register is 0 (main clock oscillating) and cm07 bit is 0 (main clock selected for the cpu clock source): (1) set the prc1 bit in the prcr register to 1 (enable writes to pm2 register). (2) set the pm21 bit in the pm2 register to 1 (disable clock modification). (3) set the prc1 bit in the prcr register to 0 (disable writes to pm2 register). do not execute the wait instruction when the pm21 bit is set to 1 . 7.8 oscillation stop and re-oscillation detect function the oscillation stop and re-oscillation detect function allows the detection of main clock oscillation stop and reoscillation. at oscillation stop or re-oscillation detection, reset or oscillation stop, re-oscillation detection interrupt are generated. depending on the cm27 bit in the cm2 register. the oscillation stop detection function can be enabled and disabled by the cm20 bit in the cm2 register. table 7.8.1 lists a specification overview of the oscillation stop and re-oscillation detect function. table 7.8.1. specification overview of oscillation stop and re-oscillation detect function item specification oscillation stop detectable clock and f(x in ) 1 (enable) re-oscillation detection function operation at oscillation stop, ? reset occurs (when the cm27 bit is set to "0") re-oscillation detection ? oscillation stop, re-oscillation detection interrupt occurs(when the cm27 bit is set to "1")
7. clock generation circuit page 58 9 2 3 f o 7 0 0 2 , 5 1 . b e f 0 0 . 2 . v e r 0 0 2 0 - 2 0 2 0 b 9 0 j e r ) t 6 2 / c 6 1 m , b 6 2 / c 6 1 m , a 6 2 / c 6 1 m ( p u o r g a 6 2 / c 6 1 m 7.8.1 operation when the cm27 bit is set to "0" (oscillation stop detection reset) when main clock stop is detected when the cm20 bit is 1 (oscillation stop, re-oscillation detection function enabled), the microcomputer is initialized, coming to a halt (oscillation stop reset; refer to 4. sfr , 5. reset ). this status is reset with hardware reset 1 or hardware reset 2. also, even when re-oscillation is detected, the microcomputer can be initialized and stopped; it is, however, necessary to avoid such usage. (during main clock stop, do not set the cm20 bit to 1 and the cm27 bit to 0 .) 7.8.2 operation when the cm27 bit is set to "1" (oscillation stop and re-oscillation detect interrupt) when the main clock corresponds to the cpu clock source and the cm20 bit is 1 (oscillation stop and re-oscillation detect function enabled), the system is placed in the following state if the main clock comes to a halt: ? oscillation stop and re-oscillation detect interrupt request occurs. ? the on-chip oscillator starts oscillation, and the on-chip oscillator clock becomes the cpu clock and clock source for peripheral functions in place of the main clock. ? cm21 bit is set to "1" (on-chip oscillator clock for cpu clock source) ? cm22 bit is set to "1" (main clock stop detected) ? cm23 bit is set to "1" (main clock stopped) when the pll clock corresponds to the cpu clock source and the cm20 bit is 1 , the system is placed in the following state if the main clock comes to a halt: since the cm21 bit remains unchanged, set it to 1 (on-chip oscillator clock) inside the interrupt routine. ? oscillation stop and re-oscillation detect interrupt request occurs. ? cm22 bit is set to "1" (main clock stop detected) ? cm23 bit is set to "1" (main clock stopped) ? cm21 bit remains unchanged when the cm20 bit is 1 , the system is placed in the following state if the main clock re-oscillates from the stop condition: ? oscillation stop and re-oscillation detect interrupt request occurs. ? cm22 bit is set to "1" (main clock re-oscillation detected) ? cm23 bit is set to "0" (main clock oscillation) ? cm21 bit remains unchanged
7. clock generation circuit page 59 9 2 3 f o 7 0 0 2 , 5 1 . b e f 0 0 . 2 . v e r 0 0 2 0 - 2 0 2 0 b 9 0 j e r ) t 6 2 / c 6 1 m , b 6 2 / c 6 1 m , a 6 2 / c 6 1 m ( p u o r g a 6 2 / c 6 1 m 7.8.3 how to use oscillation stop and re-oscillation detect function ? the oscillation stop and re-oscillation detect interrupt shares the vector with the watchdog timer inter- rupt. if the oscillation stop, re-oscillation detection and watchdog timer interrupts both are used, read the cm22 bit in an interrupt routine to determine which interrupt source is requesting the interrupt. ? where the main clock re-oscillated after oscillation stop, return the main clock to the cpu clock and peripheral function clock source in the program. figure 7.8.3.1 shows the procedure for switching the clock source from the on-chip oscillator to the main clock. ? simultaneously with oscillation stop, re-oscillation detection interrupt occurrence, the cm22 bit be- comes 1 . when the cm22 bit is set at 1 , oscillation stop, re-oscillation detection interrupt are dis- abled. by setting the cm22 bit to 0 in the program, oscillation stop, re-oscillation detection interrupt are enabled. ? if the main clock stops during low speed mode where the cm20 bit is 1 , an oscillation stop, re-oscilla- tion detection interrupt request is generated. at the same time, the on-chip oscillator starts oscillating. in this case, although the cpu clock is derived from the sub clock as it was before the interrupt oc- curred, the peripheral function clocks now are derived from the on-chip oscillator clock. ? to enter wait mode while using the oscillation stop, re-oscillation detection function, set the cm02 bit to 0 (peripheral function clocks not turned off during wait mode). ? since the oscillation stop, re-oscillation detection function is provided in preparation for main clock stop due to external factors, set the cm20 bit to 0 (oscillation stop, re-oscillation detection function dis- abled) where the main clock is stopped or oscillated in the program, that is where the stop mode is selected or the cm05 bit is altered. ? this function cannot be used if the main clock frequency is 2 mhz or less. in that case, set the cm20 bit to 0 . figure 7.8.3.1. procedure to switch clock source from on-chip oscillator to main clock switch to the main clock determine several times whether the cm23 bit is set to 0 (main clock oscillates) set the cm22 bit to 0 ("oscillatin stop, re-oscillation" not detected) set the cm06 bit to 1 (divide-by-8 mode) set the cm21 bit to 0 (main clock or pll clock) cm06: bit in the cm0 register cm23 to cm21: bits in the cm2 register yes no end note: 1. if the clock source for cpu clock is to be changed to pll clock, set to pll operation mode after set to high-speed mode.
8. protection page 60 ) t 6 2 / c 6 1 m , b 6 2 / c 6 1 m , a 6 2 / c 6 1 m ( p u o r g a 6 2 / c 6 1 m 9 2 3 f o 7 0 0 2 , 5 1 . b e f 0 0 . 2 . v e r 0 0 2 0 - 2 0 2 0 b 9 0 j e r 8. protection note the prc3 bit in the prcr register is not available in m16c/26t. in the event that a program runs out of control, this function protects the important registers so that they will not be rewritten easily. figure 8.1 shows the prcr register. the following lists the registers protected by the prcr register. ? registers protected by prc0 bit: cm0, cm1, cm2, plc0, rocr and pclkr registers ? registers protected by prc1 bit: pm0, pm1, pm2, tb2sc, invc0 and invc1 registers ? registers protected by prc2 bit: pd9, pacr and nddr registers ? registers protected by prc3 bit: vcr2 and d4int registers set the prc2 bit to 1 (write enabled) and then write to sfr area, and the prc2 bit will be cleared to 0 (write protected). the registers protected by the prc2 bit should be changed in the next instruction after setting the prc2 bit to 1 . make sure no interrupts or dma transfers will occur between the instruction in which the prc2 bit is set to 1 and the next instruction. the prc0, prc1 and prc3 bits are not automati- cally cleared to 0 by writing to any address. they can only be cleared in a program. protect register symbol address after reset prcr 000a 16 xx000000 2 bit name bit symbol b7 b6 b5 b4 b3 b2 b1 b0 0 : write protected 1 : write enable d prc1 prc0 prc2 function rw 0 rw rw rw nothing is assigned. when write, set to "0". when read, its content is indeterminate. reserved bit must set to "0" rw protect bit 0 protect bit 1 protect bit 2 enable write to cm0, cm1, cm2, rocr, plc0 and pclkr registers 0 : write protected 1 : write enabled enable write to pm0, pm1, pm2, tb2sc, invc0 and invc1 registers 0 : write protected 1 : write enabled enable write to pd9, pacr and nddr registers prc3 rw protect bit 3 0 : write protected 1 : write enabled enable write to vcr2 and d4int registers (b5-b4) (b7-b6) 0 note: 1. the prc2 bit is set to "0" if data is written to the sfr area after the prc2 bit is set to "1". the prc0, prc1 and prc3 bits are not automatically set to "0". set them to "0" by program. figure 8.1. prcr register
9. interrupt page 61 9 2 3 f o 7 0 0 2 , 5 1 . b e f 0 0 . 2 . v e r 0 0 2 0 - 2 0 2 0 b 9 0 j e r ) t 6 2 / c 6 1 m , b 6 2 / c 6 1 m , a 6 2 / c 6 1 m ( p u o r g a 6 2 / c 6 1 m ? maskable interrupt: an interrupt which can be enabled (disabled) by the interrupt enable flag (i flag) or whose interrupt priority can be changed by priority level. ? non-maskable interrupt: an interrupt which cannot be enabled (disabled) by the interrupt enable flag (i flag) or whose interrupt priority cannot be changed by priority level. figure 9.1.1. interrupts interrupt ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? 9. interrupt note the 42-pin package does not use uart0 transmission interrupt and uart0 reception interrupt of peripheral function. m16c/26t does not use voltage down detection interrupt. 9.1 type of interrupts figure 9.1.1 shows types of interrupts.
9. interrupt page 62 9 2 3 f o 7 0 0 2 , 5 1 . b e f 0 0 . 2 . v e r 0 0 2 0 - 2 0 2 0 b 9 0 j e r ) t 6 2 / c 6 1 m , b 6 2 / c 6 1 m , a 6 2 / c 6 1 m ( p u o r g a 6 2 / c 6 1 m 9.1.1 software interrupts a software interrupt occurs when executing certain instructions. software interrupts are non-maskable interrupts. 9.1.1.1 undefined instruction interrupt an undefined instruction interrupt occurs when executing the und instruction. 9.1.1.2 overflow interrupt an overflow interrupt occurs when executing the into instruction with the o flag set to 1 (the opera- tion resulted in an overflow). the following are instructions whose o flag changes by arithmetic: abs, adc, adcf, add, cmp, div, divu, divx, neg, rmpa, sbb, sha, sub 9.1.1.3 brk interrupt a brk interrupt occurs when executing the brk instruction. 9.1.1.4 int instruction interrupt an int instruction interrupt occurs when executing the int instruction. software interrupt nos. 0 to 63 can be specified for the int instruction. because software interrupt nos. 4, 8 to 31 are assigned to peripheral function interrupts, the same interrupt routine as for peripheral function interrupts can be executed by executing the int instruction. in software interrupt nos. 0 to 31, the u flag is saved to the stack during instruction execution and is cleared to 0 (isp selected) before executing an interrupt sequence. the u flag is restored from the stack when returning from the interrupt routine. in software interrupt nos. 32 to 63, the u flag does not change state during instruction execution, and the sp then selected is used.
9. interrupt page 63 9 2 3 f o 7 0 0 2 , 5 1 . b e f 0 0 . 2 . v e r 0 0 2 0 - 2 0 2 0 b 9 0 j e r ) t 6 2 / c 6 1 m , b 6 2 / c 6 1 m , a 6 2 / c 6 1 m ( p u o r g a 6 2 / c 6 1 m 9.1.2 hardware interrupts hardware interrupts are classified into two types special interrupts and peripheral function interrupts. 9.1.2.1 special interrupts special interrupts are non-maskable interrupts. _______ 9.1.2.1.1 nmi interrupt _______ _______ an nmi interrupt is generated when input on the nmi pin changes state from high to low. for details _______ _______ about the nmi interrupt, refer to the section 9.7 nmi interrupt . ________ 9.1.2.1.2 dbc interrupt this interrupt is exclusively for debugger, do not use in any other circumstances. 9.1.2.1.3 watchdog timer interrupt generated by the watchdog timer. once a watchdog timer interrupt is generated, be sure to initialize the watchdog timer. for details about the watchdog timer, refer to the section 10. watchdog timer . 9.1.2.1.4 oscillation stop and re-oscillation detection interrupt generated by the oscillation stop and re-oscillation detection function. for details about the oscilla- tion stop and re-oscillation detection function, refer to the section 7. clock generating circuit . 9.1.2.1.5 voltage down detection interrupt generated by the voltage detection circuit. for details about the voltage detection circuit, refer to the section 5.5 voltage detection circuit . 9.1.2.1.6 single-step interrupt do not normally use this interrupt because it is provided exclusively for use by development tools. 9.1.2.1.7 address match interrupt an address match interrupt is generated immediately before executing the instruction at the address indicated by the rmad0 or rmad1 register, if the corresponding enable bit (the aier0 or aier1 bit in the aier register) is set to 1 . for details about the address match interrupt, refer to the section 9.9 address match interrupt . 9.1.2.2 peripheral function interrupts peripheral function interrupts are maskable interrupts and generated by the microcomputer's internal functions. the interrupt sources for peripheral function interrupts are listed in table 9.2.2.1 relocatable vector tables . for details about the peripheral functions, refer to the description of each peripheral function in this manual.
9. interrupt page 64 9 2 3 f o 7 0 0 2 , 5 1 . b e f 0 0 . 2 . v e r 0 0 2 0 - 2 0 2 0 b 9 0 j e r ) t 6 2 / c 6 1 m , b 6 2 / c 6 1 m , a 6 2 / c 6 1 m ( p u o r g a 6 2 / c 6 1 m interrupt source vector table addresses remarks reference address (l) to address (h) undefined instruction fffdc 16 to fffdf 16 interrupt on und instruction m16c/60, m16c/20 overflow fffe0 16 to fffe3 16 interrupt on into instruction serise software brk instruction fffe4 16 to fffe7 16 maual address match fffe8 16 to fffeb 16 address match interrupt single step (1) fffec 16 to fffef 16 watchdog timer ffff0 16 to ffff3 16 watchdog timer oscillation stop and re-oscillation detection clock generating circuit voltage down detection voltage detection circuit ________ dbc (1) ffff4 16 to ffff7 16 _______ nmi ffff8 16 to ffffb 16 _______ nmi interrupt reset (2) ffffc 16 to fffff 16 reset figure 9.2.1. interrupt vector aaaaaaaaa aaaaaaaaa mid address aaaaaaaaa aaaaaaaaa low address aaaaaaaaa aaaaaaaaa 0 0 0 0 high address aaaaaaaaa aaaaaaaaa 0 0 0 0 0 0 0 0 vector address (l) lsb msb vector address (h) 9.2 interrupts and interrupt vector one interrupt vector consists of 4 bytes. set the start address of each interrupt routine in the respective interrupt vectors. when an interrupt request is accepted, the cpu branches to the address set in the corresponding interrupt vector. figure 9.2.1 shows the interrupt vector. table 9.2.1.1. fixed vector tables if the contents of address fffe7 16 is ff 16 , program ex- ecution starts from the address shown by the vector in the relocatable vector table. 9.2.1 fixed vector tables the fixed vector tables are allocated to the addresses from fffdc 16 to fffff 16 . table 9.2.1.1 lists the fixed vector tables. in the flash memory version of microcomputer, the vector addresses (h) of fixed vectors are used by the id code check function. for details, refer to the section 17.3 flash memory rewrite disabling function . notes: 1. do not normally use this interrupt because it is provided exclusively for use by development tools. 2. the b3 to b0 in address 0fffff 16 are reserve bits. set these bits to 1111 2 .
9. interrupt page 65 9 2 3 f o 7 0 0 2 , 5 1 . b e f 0 0 . 2 . v e r 0 0 2 0 - 2 0 2 0 b 9 0 j e r ) t 6 2 / c 6 1 m , b 6 2 / c 6 1 m , a 6 2 / c 6 1 m ( p u o r g a 6 2 / c 6 1 m table 9.2.2.1. relocatable vector tables software interrupt number reference vector address (1) address (l) to address (h) 0 11 12 13 14 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 63 to 10 15 16 5 to 7 8 4 9 1 to 3 interrupt source brk instruction int3 int4 int5 (2) (2) dma0 dma1 key input interrupt a/d uart0 transmit uart0 receive uart1 transmit uart1 receive timer a0 timer a1 timer a2 timer a3 timer a4 timer b0 timer b1 timer b2 int0 int1 int2 software interrupt uart 2 bus collision detection uart2 transmit, nack2 (3) uart2 receive, ack2 (3) m16c/60, m16c/20 series software manual int interrupt int interrupt serial i/o dmac key input interrupt a/d convertor serial i/o timer int interrupt m16c/60, m16c/20 series software manual (4) (reserved) +0 to +3 (0000 16 to 0003 16 ) +44 to +47 (002c 16 to 002f 16 ) +48 to +51 (0030 16 to 0033 16 ) +52 to +55 (0034 16 to 0037 16 ) +56 to +59 (0038 16 to 003b 16 ) +68 to +71 (0044 16 to 0047 16 ) +72 to +75 (0048 16 to 004b 16 ) +76 to +79 (004c 16 to 004f 16 ) +80 to +83 (0050 16 to 0053 16 ) +84 to +87 (0054 16 to 0057 16 ) +88 to +91 (0058 16 to 005b 16 ) +92 to +95 (005c 16 to 005f 16 ) +96 to +99 (0060 16 to 0063 16 ) +100 to +103 (0064 16 to 0067 16 ) +104 to +107 (0068 16 to 006b 16 ) +108 to +111 (006c 16 to 006f 16 ) +112 to +115 (0070 16 to 0073 16 ) +116 to +119 (0074 16 to 0077 16 ) +120 to +123 (0078 16 to 007b 16 ) +124 to +127 (007c 16 to 007f 16 ) +128 to +131 (0080 16 to 0083 16 ) +252 to +255 (00fc 16 to 00ff 16 ) +40 to +43 (0028 16 to 002b 16 ) +60 to +63 (003c 16 to 003f 16 ) +64 to +67 (0040 16 to 0043 16 ) +32 to +35 (0020 16 to 0023 16 ) +16 to +19 (0010 16 to 0013 16 ) +36 to +39 (0024 16 to 0027 16 ) to (4) (5) (reserved) notes: 1. address relative to address in intb. 2. set the ifsr6 and ifsr7 bits in the ifsr register. 3. during i 2 c bus mode, nack and ack interrupts comprise the interrupt source. 4. these interrupts cannot be disabled using the i flag. 5. bus collision detection: during iebus mode, this bus collision detection constitutes the cause of an interrupt. during i 2 c bus mode, however, a start condition or a stop condition detection constitutes the cause of an interrupt. 9.2.2 relocatable vector tables the 256 bytes beginning with the start address set in the intb register comprise a reloacatable vector table area. table 9.2.2.1 lists the relocatable vector tables. setting an even address in the intb register results in the interrupt sequence being executed faster than in the case of odd addresses.
9. interrupt page 66 9 2 3 f o 7 0 0 2 , 5 1 . b e f 0 0 . 2 . v e r 0 0 2 0 - 2 0 2 0 b 9 0 j e r ) t 6 2 / c 6 1 m , b 6 2 / c 6 1 m , a 6 2 / c 6 1 m ( p u o r g a 6 2 / c 6 1 m 9.3 interrupt control the following describes how to enable/disable the maskable interrupts, and how to set the priority in which order they are accepted. what is explained here does not apply to nonmaskable interrupts. use the i flag in the flg register, ipl, and the ilvl2 to ilvl0 bits in the each interrupt control register to enable/disable the maskable interrupts. whether an interrupt is requested is indicated by the ir bit in each interrupt control register. figure 9.3.1 shows the interrupt control registers. figure 9.3.2 shows the ifsr, ifsr2a registers.
9. interrupt page 67 9 2 3 f o 7 0 0 2 , 5 1 . b e f 0 0 . 2 . v e r 0 0 2 0 - 2 0 2 0 b 9 0 j e r ) t 6 2 / c 6 1 m , b 6 2 / c 6 1 m , a 6 2 / c 6 1 m ( p u o r g a 6 2 / c 6 1 m figure 9.3.1. interrupt control registers symbol address after reset int3ic 0044 16 xx00x000 2 int5ic 0048 16 xx00x000 2 int4ic 0049 16 xx00x000 2 int0ic to int2ic 005d 16 to 005f 16 xx00x000 2 bit name function bit symbol b7 b6 b5 b4 b3 b2 b1 b0 ilvl0 ir po l no functions are assigned. when writing to these bits, write 0 . the values in these bits when read are indeterminate. interrupt priority level select bit interrupt request bit polarity select bit reserved bit 0: interrupt not requested 1: interrupt requested 0 : selects falling edge (3) 1 : selects rising edge must always be set to 0 ilvl1 ilvl2 (1) interrupt control register (2) b7 b6 b5 b4 b3 b2 b1 b0 bit name function bit symbol rw symbol address after reset bcnic 004a 16 xxxxx000 2 dm0ic, dm1ic 004b 16 , 004c 16 xxxxx000 2 kupic 004d 16 xxxxx000 2 adic 004e 16 xxxxx000 2 s0tic to s2tic 0051 16 , 0053 16 , 004f 16 xxxxx000 2 s0ric to s2ric 0052 16 , 0054 16 , 0050 16 xxxxx000 2 ta0ic to ta4ic 0055 16 to 0059 16 xxxxx000 2 tb0ic to tb2ic 005a 16 to 005c 16 xxxxx000 2 ilvl0 ir interrupt priority level select bit interrupt request bit 0 : interrupt not requested 1 : interrupt requested ilvl1 ilvl2 no functions are assigned. when writing to these bits, write 0 . the values in these bits when read are indeterminate. (1) 0 0 0 : level 0 (interrupt disabled) 0 0 1 : level 1 0 1 0 : level 2 0 1 1 : level 3 1 0 0 : level 4 1 0 1 : level 5 1 1 0 : level 6 1 1 1 : level 7 b2 b1 b0 0 0 0 : level 0 (interrupt disabled) 0 0 1 : level 1 0 1 0 : level 2 0 1 1 : level 3 1 0 0 : level 4 1 0 1 : level 5 1 1 0 : level 6 1 1 1 : level 7 b2 b1 b0 0 rw rw rw rw (b7-b4) rw rw rw rw rw rw rw rw (b7-b6) (b5) notes: 1.this bit can only be reset by writing 0 (do not write 1 ). 2. to rewrite the interrupt control registers, do so at a point that does not generate the interrupt request for that register. for details, see 19.5 interrupts . notes: 1. this bit can only be reset by writing 0 (do not write 1 ). 2. to rewrite the interrupt control register, do so at a point that does not generate the interrupt request for that register. for details, see 19.5 interrupts . 3. if the ifsri bit (i = 0 to 5) in the ifsr register is 1 (both edges), set the pol bit in the intiic register to 0 (falling edge). bcnic, dm0ic, dm1ic, kupic, adic, s0tic to s2tic, s0ric to s2ric, ta0ic to ta4ic, tb0ic to tb2ic, int3ic, int4ic, int5ic, int0ic to int2ic
9. interrupt page 68 9 2 3 f o 7 0 0 2 , 5 1 . b e f 0 0 . 2 . v e r 0 0 2 0 - 2 0 2 0 b 9 0 j e r ) t 6 2 / c 6 1 m , b 6 2 / c 6 1 m , a 6 2 / c 6 1 m ( p u o r g a 6 2 / c 6 1 m figure 9.3.2. ifsr register and ifsr2a register interrupt request cause select register bit name function bit symbol rw symbol address after reset ifsr 035f 16 00 16 ifsr0 b7 b6 b5 b4 b3 b2 b1 b0 int0 interrupt polarity switching bit 0 : reserved 1 : int4 0 : reserved 1 : int5 0 : one edge 1 : both edges 0 : one edge 1 : both edges 0 : one edge 1 : both edges 0 : one edge 1 : both edges 0 : one edge 1 : both edges int1 interrupt polarity switching bit int2 interrupt polarity switching bit int3 interrupt polarity switching bit int4 interrupt polarity switching bit int5 interrupt polarity switching bit 0 : one edge 1 : both edges interrupt request cause select bit interrupt request cause select bit ifsr1 ifsr2 ifsr3 ifsr4 ifsr5 ifsr6 ifsr7 rw rw rw rw rw rw rw rw (1) (1) (1) (1) (1) (1) note: 1. when setting this bit to 1 (= both edges), make sure the pol bit in the int0ic to int5ic register is set to 0 (= falling edge). interrupt request cause select register 2 bit name function bit symbol rw symbol address after reset ifsr2a 035e 16 xxxxxxx0 2 b7 b6 b5 b4 b3 b2 b1 b0 must be set to 1 . (b7-b1) nothing is assigned. when write, set to 0 . when read, their contents are indeterminate. ifsr20 1 reserved bit rw (1) note: 1. set this bit to "1" before you enable interrupt after resetting.
9. interrupt page 69 9 2 3 f o 7 0 0 2 , 5 1 . b e f 0 0 . 2 . v e r 0 0 2 0 - 2 0 2 0 b 9 0 j e r ) t 6 2 / c 6 1 m , b 6 2 / c 6 1 m , a 6 2 / c 6 1 m ( p u o r g a 6 2 / c 6 1 m 9.3.1 i flag the i flag enables or disables the maskable interrupt. setting the i flag to 1 (= enabled) enables the maskable interrupt. setting the i flag to 0 (= disabled) disables all maskable interrupts. 9.3.2 ir bit the ir bit is set to 1 (= interrupt requested) when an interrupt request is generated. then, when the interrupt request is accepted and the cpu branches to the corresponding interrupt vector, the ir bit is cleared to 0 (= interrupt not requested). the ir bit can be cleared to 0 in a program. note that do not write 1 to this bit. 9.3.3 ilvl2 to ilvl0 bits and ipl interrupt priority levels can be set using the ilvl2 to ilvl0 bits. table 9.3.3.1 shows the settings of interrupt priority levels and table 9.3.3.2 shows the interrupt priority levels enabled by the ipl. the following are conditions under which an interrupt is accepted: i flag is set to 1 ir bit is set to 1 interrupt priority level > ipl the i flag, ir bit, ilvl2 to ilvl0 bits and ipl are independent of each other. in no case do they affect one another. table 9.3.3.2. interrupt priority levels enabled by ipl table 9.3.3.1. settings of interrupt priority levels ilvl2 to ilvl0 bits interrupt priority level priority order 000 2 001 2 010 2 011 2 100 2 101 2 110 2 111 2 level 0 (interrupt disabled) level 1 level 2 level 3 level 4 level 5 level 6 level 7 low high enabled interrupt priority levels interrupt levels 1 and above are enabled interrupt levels 2 and above are enabled interrupt levels 3 and above are enabled interrupt levels 4 and above are enabled interrupt levels 5 and above are enabled interrupt levels 6 and above are enabled interrupt levels 7 and above are enabled all maskable interrupts are disabled ipl 000 2 001 2 010 2 011 2 100 2 101 2 110 2 111 2
9. interrupt page 70 9 2 3 f o 7 0 0 2 , 5 1 . b e f 0 0 . 2 . v e r 0 0 2 0 - 2 0 2 0 b 9 0 j e r ) t 6 2 / c 6 1 m , b 6 2 / c 6 1 m , a 6 2 / c 6 1 m ( p u o r g a 6 2 / c 6 1 m 9.4 interrupt sequence an interrupt sequence (the devicebehavior from the instant an interrupt is accepted to the instant the inter- rupt routine is executed) is described here. if an interrupt occurs during execution of an instruction, the processor determines its priority when the execution of the instruction is completed, and transfers control to the interrupt sequence from the next cycle. if an interrupt occurs during execution of either the smovb, smovf, sstr or rmpa instruction, the processor temporarily suspends the instruction being executed, and transfers control to the interrupt sequence. the cpu behavior during the interrupt sequence is described below. figure 9.4.1 shows time required for executing the interrupt sequence. (1) the cpu gets interrupt information (interrupt number and interrupt request priority level) by reading the address 00000 16 . then it clears the ir bit for the corresponding interrupt to 0 (interrupt not requested). (2) the flg register immediately before entering the interrupt sequence is saved to the cpu s internal temporary register (1) . (3) the i, d and u flags in the flg register become as follows: the i flag is cleared to 0 (interrupts disabled). the d flag is cleared to 0 (single-step interrupt disabled). the u flag is cleared to 0 (isp selected). however, the u flag does not change state if an int instruction for software interrupt nos. 32 to 63 is executed. (4) the cpu s internal temporary register (1) is saved to the stack. (5) the pc is saved to the stack. (6) the interrupt priority level of the accepted interrupt is set in the ipl. (7) the start address of the relevant interrupt routine set in the interrupt vector is stored in the pc. after the interrupt sequence is completed, the processor resumes executing instructions from the start address of the interrupt routine. note: 1. this register cannot be used by user. indeterminate (1) 123456789 1011 12 13 14 15 16 17 18 indeterminate (1) sp-2 contents sp-4 contents vec contents vec+2 contents interrupt information address 0000 16 indeterminate (1) sp-2 sp-4 vec vec+2 pc cpu clock address bus data bus wr (2) rd (2) notes: 1. the indeterminate state depends on the instruction queue buffer. a read cycle occurs when the instruction queue buffer is ready to accept instructions. 2. rd is the internal signal which is set to l when the internal memory is read out and wr is the internal signal which is set to l when the internal memory is written. figure 9.4.1. time required for executing interrupt sequence
9. interrupt page 71 9 2 3 f o 7 0 0 2 , 5 1 . b e f 0 0 . 2 . v e r 0 0 2 0 - 2 0 2 0 b 9 0 j e r ) t 6 2 / c 6 1 m , b 6 2 / c 6 1 m , a 6 2 / c 6 1 m ( p u o r g a 6 2 / c 6 1 m interrupt sources 7 level that is set to ipl _______ watchdog timer, nmi, oscillation stop and re-oscillation detection, voltage down detection _________ software, address match, dbc, single-step not changed 9.4.2 variation of ipl when interrupt request is accepted when a maskable interrupt request is accepted, the interrupt priority level of the accepted interrupt is set in the ipl. when a software interrupt or special interrupt request is accepted, one of the interrupt priority levels listed in table 9.4.2.1 is set in the ipl. shown in table 9.4.2.1 are the ipl values of software and special interrupts when they are accepted. table 9.4.2.1. ipl level that is set to ipl when a software or special interrupt is accepted instruction interrupt sequence instruction in interrupt routine time interrupt response time (a) (b) interrupt request acknowledged interrupt request generated (a) the time from when an interrupt request is generated till when the instruction then executing is completed. the length of this time varies with the instruction being executed. the divx instruction requires the longest time, which is equal to 30 cycles (without wait state, the divisor being a register). (b) the time during which the interrupt sequence is executed. for details, see the table below. note, however, that the values in this table must be increased 2 cycles for the dbc interrupt and 1 cycle for the address match and single-step interrupts. interrupt vector address even even odd odd sp value even odd even odd without wait 18 cycles 19 cycles 19 cycles 20 cycles figure 9.4.1.1. interrupt response time 9.4.1 interrupt response time figure 9.4.1.1 shows the interrupt response time. the interrupt response or interrupt acknowledge time denotes the time from when an interrupt request is generated till when the first instruction in the interrupt routine is executed. specifically, it consists of the time from when an interrupt request is generated till when the instruction then executing is completed ((a) in figure 9.4.1.1) and the time during which the interrupt sequence is executed ((b) in figure 9.4.1.1).
9. interrupt page 72 9 2 3 f o 7 0 0 2 , 5 1 . b e f 0 0 . 2 . v e r 0 0 2 0 - 2 0 2 0 b 9 0 j e r ) t 6 2 / c 6 1 m , b 6 2 / c 6 1 m , a 6 2 / c 6 1 m ( p u o r g a 6 2 / c 6 1 m 9.4.3 saving registers in the interrupt sequence, the flg register and pc are saved to the stack. at this time, the 4 high-order bits of the pc and the 4 high-order (ipl) and 8 low-order bits in the flg register, 16 bits in total, are saved to the stack first. next, the 16 low-order bits of the pc are saved. figure 9.4.3.1 shows the stack status before and after an interrupt request is accepted. the other necessary registers must be saved in a program at the beginning of the interrupt routine. use the pushm instruction, and all registers except sp can be saved with a single instruction. address content of previous stack stack [sp] sp value before interrupt request is accepted. m m C 1 m C 2 m C 3 m C 4 stack status before interrupt request is acknowledged stack status after interrupt request is acknowledged content of previous stack m + 1 msb lsb m m C 1 m C 2 m C 3 m C 4 address flg l content of previous stack stack flg h pc h [sp] new sp value content of previous stack m + 1 msb lsb pc l pc m figure 9.4.3.1. stack status before and after acceptance of interrupt request
9. interrupt page 73 9 2 3 f o 7 0 0 2 , 5 1 . b e f 0 0 . 2 . v e r 0 0 2 0 - 2 0 2 0 b 9 0 j e r ) t 6 2 / c 6 1 m , b 6 2 / c 6 1 m , a 6 2 / c 6 1 m ( p u o r g a 6 2 / c 6 1 m figure 9.4.3.2. operation of saving register (2) sp contains odd number [sp] (odd) [sp] C 1 (even) [sp] C 2 (odd) [sp] C 3 (even) [sp] C 4 (odd) [sp] C 5 (even) address sequence in which order registers are saved (2) (1) finished saving registers in four operations. (3) (4) (1) sp contains even number [sp] (even) [sp] C 1 (odd) [sp] C 2 (even) [sp] C 3 (odd) [sp] C 4 (even) [sp] C 5 (odd) note: 1. [sp] denotes the initial value of the sp when interrupt request is acknowledged. after registers are saved, the sp content is [sp] minus 4. address pc m stack flg l pc l sequence in which order registers are saved (2) saved simultaneously, all 16 bits (1) saved simultaneously, all 16 bits finished saving registers in two operations. pc m stack flg l pc l saved, 8 bits at a time flg h pc h flg h pc h the operation of saving registers carried out in the interrupt sequence is dependent on whether the sp (1) , at the time of acceptance of an interrupt request, is even or odd. if the stack pointer (1) is even, the flg register and the pc are saved, 16 bits at a time. if odd, they are saved in two steps, 8 bits at a time. figure 9.4.3.2 shows the operation of the saving registers. note: 1. when any int instruction in software numbers 32 to 63 has been executed, this is the sp indicated by the u flag. otherwise, it is the isp.
9. interrupt page 74 9 2 3 f o 7 0 0 2 , 5 1 . b e f 0 0 . 2 . v e r 0 0 2 0 - 2 0 2 0 b 9 0 j e r ) t 6 2 / c 6 1 m , b 6 2 / c 6 1 m , a 6 2 / c 6 1 m ( p u o r g a 6 2 / c 6 1 m 9.5 interrupt priority if two or more interrupt requests are generated while executing one instruction, the interrupt request that has the highest priority is accepted. for maskable interrupts (peripheral functions), any desired priority level can be selected using the ilvl2 to ilvl0 bits. however, if two or more maskable interrupts have the same priority level, their interrupt priority is resolved by hardware, with the highest priority interrupt accepted. the watchdog timer and other special interrupts have their priority levels set in hardware. figure 9.5.1 shows the priorities of hardware interrupts. software interrupts are not affected by the interrupt priority. if an instruction is executed, control branches invariably to the interrupt routine. 9.4.4 returning from an interrupt routine the flg register and pc in the state in which they were immediately before entering the interrupt se- quence are restored from the stack by executing the reit instruction at the end of the interrupt routine. thereafter the cpu returns to the program which was being executed before accepting the interrupt request. return the other registers saved by a program within the interrupt routine using the popm or similar instruction before executing the reit instruction. 9.5.1 interrupt priority resolution circuit the interrupt priority resolution circuit is used to select the interrupt with the highest priority among those requested. figure 9.5.1.1 shows the circuit that judges the interrupt priority level. figure 9.5.1. hardware interrupt priority reset watchdog timer, oscillation stop and re-oscillation detection, voltage down detection peripheral function single step address match high low nmi dbc
9. interrupt page 75 9 2 3 f o 7 0 0 2 , 5 1 . b e f 0 0 . 2 . v e r 0 0 2 0 - 2 0 2 0 b 9 0 j e r ) t 6 2 / c 6 1 m , b 6 2 / c 6 1 m , a 6 2 / c 6 1 m ( p u o r g a 6 2 / c 6 1 m figure 9.5.1.1. interrupts priority select circuit timer b2 timer b0 timer a3 timer a1 timer b1 timer a4 timer a2 uart1 reception uart0 reception uart2 reception, ack2 a/d conversion dma1 uart 2 bus collision timer a0 uart1 transmission uart0 transmission uart2 transmission, nack2 key input interrupt dma0 ipl i flag int1 int2 int0 watchdog timer dbc nmi interrupt request accepted level 0 (initial value) priority level of each interrupt highest lowest priority of peripheral function interrupts (if priority levels are same) int3 int5 int4 address match interrupt request level resolution output to clock generating circuit (fig.7.1.) oscillation stop and re-oscillation detection voltage down detection
9. interrupt page 76 9 2 3 f o 7 0 0 2 , 5 1 . b e f 0 0 . 2 . v e r 0 0 2 0 - 2 0 2 0 b 9 0 j e r ) t 6 2 / c 6 1 m , b 6 2 / c 6 1 m , a 6 2 / c 6 1 m ( p u o r g a 6 2 / c 6 1 m ______ 9.6 int interrupt _______ inti interrupt (i=0 to 5) is triggered by the edges of external inputs. the edge polarity is selected using the ifsri bit in the ifsr register. ________ ________ ________ to use the int4 interrupt, set the ifsr6 bit in the ifsr register to "1" (=int4). to use the int5 interrupt, set ________ the ifsr7 bit in the ifsr register to "1" (=int5). after modifiying the ifsr6 or ifsr7 bit, clear the corresponding ir bit to "0" (=interrupt not requested) before enabling the interrupt. ________ the int5 input has an effective digital debounce function for a noize rejection. refer to 16.6 digital ________ debounce function for this detail. when using int5 interrupt to exit stop mode, set the p17ddr register to "ff 16 " before entering stop mode. figure 9.6.1 shows the ifsr register. figure 9.6.1. ifsr register interrupt request cause select register bit name function bit symbol rw symbol address after reset ifsr 035f 16 00 16 ifsr0 b7 b6 b5 b4 b3 b2 b1 b0 int0 interrupt polarity switching bit 0 : reserved 1 : int4 0 : reserved 1 : int5 0 : one edge 1 : both edges 0 : one edge 1 : both edges 0 : one edge 1 : both edges 0 : one edge 1 : both edges 0 : one edge 1 : both edges int1 interrupt polarity switching bit int2 interrupt polarity switching bit int3 interrupt polarity switching bit int4 interrupt polarity switching bit int5 interrupt polarity switching bit 0 : one edge 1 : both edges interrupt request cause select bit interrupt request cause select bit ifsr1 ifsr2 ifsr3 ifsr4 ifsr5 ifsr6 ifsr7 rw rw rw rw rw rw rw rw (1) (1) (1) (1) (1) (1) note: 1. when setting this bit to 1 (= both edges), make sure the pol bit in the int0ic to int5ic register is set to 0 (= falling edge).
9. interrupt page 77 9 2 3 f o 7 0 0 2 , 5 1 . b e f 0 0 . 2 . v e r 0 0 2 0 - 2 0 2 0 b 9 0 j e r ) t 6 2 / c 6 1 m , b 6 2 / c 6 1 m , a 6 2 / c 6 1 m ( p u o r g a 6 2 / c 6 1 m figure 9.8.1. key input interrupt ______ 9.7 nmi interrupt _______ _______ an nmi interrupt request is generated when input on the nmi pin changes state from high to low, after the _______ ______ nmi interrupt was enabled by writing a 1 to pm24 bit in the pm2 register. the nmi interrupt is a non- maskable interrupt, once it is enabled. _______ the input level of this nmi interrupt input pin can be read by accessing the p8_5 bit in the p8 register. _______ nmi is disabled by default after reset (the pin is a gpio pin, p8 5 ) and can be enabled using pm24 bit in the pm2 register. once enabled, it can only be disabled by a reset signal. _______ the nmi input has an effective digital debounce function for a noise rejection. refer to 16.6 digital _______ debounce function for this detail. when using nmi interrupt to exit stop mode, set the nddr register to "ff 16 " before entering stop mode. 9.8 key input interrupt of p10 4 to p10 7 , a key input interrupt is generated when input on any of the p10 4 to p10 7 pins which has had the pd10_4 to pd10_7 bits in the pd10 register set to 0 (= input) goes low. key input interrupts can be used as a key-on wakeup function, the function which gets the microcomputer out of wait or stop mode. however, if you intend to use the key input interrupt, do not use p10 4 to p10 7 as analog input ports. figure 9.8.1 shows the block diagram of the key input interrupt. note, however, that while input on any pin which has had the pd10_4 to pd10_7 bits set to 0 (= input mode) is pulled low, inputs on all other pins of the port are not detected as interrupts. interrupt control circuit kupic register key input interrupt request ki 3 ki 2 ki 1 ki 0 pu25 bit in the pd10 register pd10_7 bit in the pd10 register pull-up transistor pd10_7 bit in the pd10 register pd10_6 bit in the pd10 register pd10_5 bit in the pd10 register pd10_4 bit in the pd10 register pull-up transistor pull-up transistor pull-up transistor
9. interrupt page 78 9 2 3 f o 7 0 0 2 , 5 1 . b e f 0 0 . 2 . v e r 0 0 2 0 - 2 0 2 0 b 9 0 j e r ) t 6 2 / c 6 1 m , b 6 2 / c 6 1 m , a 6 2 / c 6 1 m ( p u o r g a 6 2 / c 6 1 m table 9.9.2. relationship between address match interrupt sources and associated registers address match interrupt sources address match interrupt enable bit address match interrupt register address match interrupt 0 aier0 rmad0 address match interrupt 1 aier1 rmad1 9.9 address match interrupt an address match interrupt request is generated immediately before executing the instruction at the ad- dress indicated by the rmadi register (i=0 to 1). set the start address of any instruction in the rmadi register. use the aier register s aier0 and aier1 bits to enable or disable the interrupt. note that the address match interrupt is unaffected by the i flag and ipl. for address match interrupts, the value of the pc that is saved to the stack area varies depending on the instruction being executed (refer to saving registers ). (the value of the pc that is saved to the stack area is not the correct return address.) therefore, follow one of the methods described below to return from the address match interrupt. ? rewrite the content of the stack and then use the reit instruction to return. ? restore the stack to its previous state before the interrupt request was accepted by using the pop or similar other instruction and then use a jump instruction to return. table 9.9.1 shows the value of the pc that is saved to the stack area when an address match interrupt request is accepted. figure 9.9.1 shows the aier, rmad0 and rmad1 registers. table 9.9.1. value of the pc that is saved to the stack area when an address match interrupt request is accepted. ? 2-byte op-code instruction ? 1-byte op-code instructions which are followed: add.b:s #imm8,dest sub.b:s #imm8,dest and.b:s #imm8,dest or.b:s #imm8,dest mov.b:s #imm8,dest stz.b #imm8,dest stnz.b #imm8,dest stzx.b #imm81,#imm82,dest cmp.b:s #imm8,dest pushm src popm dest jmps #imm8 jsrs #imm8 mov.b:s #imm,dest (however, dest=a0 or a1) instructions other than the above instruction at the address indicated by the rmadi register value of the pc that is saved to the stack area the address indicated by the rmadi register +2 the address indicated by the rmadi register +1 value of the pc that is saved to the stack area : refer to saving registers . op-code is an abbreviation of operation code. it is a portion of instruction code. refer to chapter 4 instruction code/number of cycles in m16c/60, m16c/20 series software manual. op-code is shown as a bold-framed figure directly below the syntax.
9. interrupt page 79 9 2 3 f o 7 0 0 2 , 5 1 . b e f 0 0 . 2 . v e r 0 0 2 0 - 2 0 2 0 b 9 0 j e r ) t 6 2 / c 6 1 m , b 6 2 / c 6 1 m , a 6 2 / c 6 1 m ( p u o r g a 6 2 / c 6 1 m figure 9.9.1. aier register, rmad0 and rmad1 registers bit name bit symbol symbol address after reset aier 0009 16 xxxxxx00 2 address match interrupt enable register function rw address match interrupt 0 enable bit 0 : interrupt disabled 1 : interrupt enabled aier0 address match interrupt 1 enable bit aier1 symbol address after reset rmad0 0012 16 to 0010 16 x00000 16 rmad1 0016 16 to 0014 16 x00000 16 b7 b6 b5 b4 b3 b2 b1 b0 address setting register for address match interrupt function setting range address match interrupt register i (i = 0 to 1) 00000 16 to fffff 16 0 : interrupt disabled 1 : interrupt enabled b0 b7 b0 b3 (b19) (b16) b7 b0 (b15) (b8) b7 (b23) rw rw (b7-b2) rw rw nothing is assigned. when write, set to 0 . when read, their contents are indeterminate. nothing is assigned. when write, set to 0 . when read, their contents are indeterminate.
10. watchdog timer page 80 9 2 3 f o 7 0 0 2 , 5 1 . b e f 0 0 . 2 . v e r 0 0 2 0 - 2 0 2 0 b 9 0 j e r ) t 6 2 / c 6 1 m , b 6 2 / c 6 1 m , a 6 2 / c 6 1 m ( p u o r g a 6 2 / c 6 1 m for example, when cpu clock = 16 mhz and the divide-by-n value for the prescaler= 16, the watchdog timer period is approx. 32.8 ms. the watchdog timer is initialized by writing to the wdts register. the prescaler is initialized after reset. note that the watchdog timer and the prescaler both are inactive after reset, so that the watchdog timer is activated to start counting by writing to the wdts register. write the wdts register with shorter cycle than the watchdog timer cycle. set the wdts register also in the beginning of the watchdog timer interrupt routine. in stop mode, wait mode and when erase/program opration is excuting in ew1 mode without erase suspend requeired, the watchdog timer and prescaler are stopped. counting is resumed from the held value when the modes or state are released. figure 10.1 shows the block diagram of the watchdog timer. figure 10.2 shows the watchdog timer-related registers. with main clock source chosen for cpu clock, on-chip oscillator clock, pll clock watchdog timer period = with sub-clock chosen for cpu clock watchdog timer period = prescaler dividing (16 or 128) x watchdog timer count (32768) cpu clock prescaler dividing (2) x watchdog timer count (32768) cpu clock figure 10.1. watchdog timer block diagram 10. watchdog timer the watchdog timer is the function that detects when a program is out of control. use the watchdog timer is recommended to improve reliability of the system. the watchdog timer contains a 15-bit counter which is decremented by the cpu clock that the prescaler divides. the pm12 bit in the pm1 register determines whether to generate a watchdog timer interrupt request or reset the watchdog timer when the watchdog timer underflows. the pm12 bit can only be set to 1 (reset). once the pm12 bit is set to 1 , it cannot be changed to 0 (watchdog timer interrupt) by program. refer to 5.3 watchdog timer reset for watchdog timer reset. when the main clock, on-chip oscillator clock, or pll clock runs as cpu clock, the wdc7 bit in the wdc register determines whether the prescaler divides the clock by 16 or 128. when the sub clock runs as cpu clock, the prescaler divides the clock by 2 regardless of the wdc7 bit setting. watchdog timer cycle is calculated as follows. marginal errors, due to the prescaler, may occur in watchdog timer cycle. cpu clock write to wdts register pm12 = 0 watchdog timer set to 7fff 16 1/12 8 1/16 cm07 = 0 wdc7 = 1 cm07 = 0 wdc7 = 0 cm07 = 1 1/ 2 prescaler pm12 = 1 reset pm22 = 0 pm22 = 1 on-chip oscillator clock internal reset signal (low active) watchdog timer interrupt request
10. watchdog timer page 81 9 2 3 f o 7 0 0 2 , 5 1 . b e f 0 0 . 2 . v e r 0 0 2 0 - 2 0 2 0 b 9 0 j e r ) t 6 2 / c 6 1 m , b 6 2 / c 6 1 m , a 6 2 / c 6 1 m ( p u o r g a 6 2 / c 6 1 m 10.1 count source protective mode in this mode, a on-chip oscillator clock is used for the watchdog timer count source. the watchdog timer can be kept being clocked even when cpu clock stops as a result of run-away. before this mode can be used, the following register settings are required: (1) set the prc1 bit in the prcr register to 1 (enable writes to pm1 and pm2 registers). (2) set the pm12 bit in the pm1 register to 1 (reset when the watchdog timer underflows). (3) set the pm22 bit in the pm2 register to 1 (on-chip oscillator clock used for the watchdog timer count source). (4) set the prc1 bit in the prcr register to 0 (disable writes to pm1 and pm2 registers). (5) write to the wdts register (watchdog timer starts counting). setting the pm22 bit to 1 results in the following conditions ? the on-chip oscillator continues oscillating even if the cm21 bit in the cm2 register is set to "0" (main clock or pll clock) (system clock of count source selected by the cm21 bit is valid) ? the on-chip oscillator starts oscillating, and the in-chip oscillator clock becomes the watchdog timer count source. ? the cm10 bit in the cm1 register is disabled against write. (writing a 1 has no effect, nor is stop mode entered.) ? the watchdog timer does not stop when in wait mode. figure 10.2 wdc register and wdts register watchdog timer period = watchdog timer count (32768) on-chip oscillator clock watchdog timer control register symbol address after reset wdc 000f 16 00xxxxxx 2 function bit symbol rw b7 b6 b5 b4 b3 b2 b1 b0 high-order bit of watchdog timer wdc7 bit name prescaler select bit 0: divided by 16 1: divided by 128 0 ro rw rw (b4-b0) 0 (b6-b5) reserved bit set to 0 watchdog timer start register symbol address after reset wdts 000e 16 indeterminate wo b7 b0 functio n the watchdog timer is initialized and starts counting after a write instruction to this register. the watchdog timer value is always initialized to 7fff 16 regardless of whatever value is written. rw
11. dmac page 82 9 2 3 f o 7 0 0 2 , 5 1 . b e f 0 0 . 2 . v e r 0 0 2 0 - 2 0 2 0 b 9 0 j e r ) t 6 2 / c 6 1 m , b 6 2 / c 6 1 m , a 6 2 / c 6 1 m ( p u o r g a 6 2 / c 6 1 m 11. dmac note do not use uart0 transfer and uart0 reception interrupt request as a dma request in the 42-pin package. the dmac (direct memory access controller) allows data to be transferred without the cpu intervention. two dmac channels are included. each time a dma request occurs, the dmac transfers one (8 or 16-bit) data from the source address to the destination address. the dmac uses the same data bus as used by the cpu. because the dmac has higher priority of bus control than the cpu and because it makes use of a cycle steal method, it can transfer one word (16 bits) or one byte (8 bits) of data within a very short time after a dma request is generated. figure 11.1 shows the block diagram of the dmac. table 11.1 shows the dmac specifications. figures 11.2 to 11.4 show the dmac-related registers. a dma request is generated by a write to the dsr bit in the dmisl register (i = 0,1), as well as by an interrupt request which is generated by any function specified by the dms and dsel3 to dsel0 bits in the dmisl register. however, unlike in the case of interrupt requests, dma requests are not affected by the i flag and the interrupt control register, so that even when interrupt requests are disabled and no interrupt request can be accepted, dma requests are always accepted. furthermore, because the dmac does not affect interrupts, the ir bit in the interrupt control register does not change state due to a dma transfer. a data transfer is initiated each time a dma request is generated when the dmae bit in the dmicon register is set to 1 (dma enabled). however, if the cycle in which a dma request is generated is faster than the dma transfer cycle, the number of transfer requests generated and the number of times data is transferred may not match. for details, refer to 11.4 dma requests . figure 11.1 dmac block diagram data bus low-order bits dma latch high-order bits dma latch low-order bits dma0 source pointer sar0(20) dma0 destination pointer dar0 (20) dma0 forward address pointer (20) (1) data bus high-order bits address bus dma1 destination pointer dar1 (20) dma1 source pointer sar1 (20) dma1 forward address pointer (20) (1) dma0 transfer counter reload register tcr0 (16) dma0 transfer counter tcr0 (16) dma1 transfer counter reload register tcr1 (16) dma1 transfer counter tcr1 (16) (addresses 0029 16 , 0028 16 ) (addresses 0039 16 , 0038 16 ) (addresses 0022 16 to 0020 16 ) (addresses 0026 16 to 0024 16 ) (addresses 0032 16 to 0030 16 ) (addresses 0036 16 to 0034 16 ) note: 1. pointer is incremented by a dma request.
11. dmac page 83 9 2 3 f o 7 0 0 2 , 5 1 . b e f 0 0 . 2 . v e r 0 0 2 0 - 2 0 2 0 b 9 0 j e r ) t 6 2 / c 6 1 m , b 6 2 / c 6 1 m , a 6 2 / c 6 1 m ( p u o r g a 6 2 / c 6 1 m table 11.1 dmac specifications item specification no. of channels 2 (cycle steal method) transfer memory space ? from any address in the 1m bytes space to a fixed address ? from a fixed address to any address in the 1m bytes space ? from a fixed address to a fixed address maximum no. of bytes transferred 128k bytes (with 16-bit transfers) or 64k bytes (with 8-bit transfers) dma request factors (1, 2) ________ ________ falling edge of int0 or int1 ________ ________ both edge of int0 or int1 timer a0 to timer a4 interrupt requests timer b0 to timer b2 interrupt requests uart0 transfer, uart0 reception interrupt requests uart1 transfer, uart1 reception interrupt requests uart2 transfer, uart2 reception interrupt requests a/d conversion interrupt requests software triggers channel priority dma0 > dma1 (dma0 takes precedence) transfer unit 8 bits or 16 bits transfer address direction forward or fixed (the source and destination addresses cannot both be in the forward direction.) transfer mode single transfer transfer is completed when the dmai transfer counter (i = 0,1) underflows after reaching the terminal count. repeat transfer when the dmai transfer counter underflows, it is reloaded with the value of the dmai transfer counter reload register and a dma transfer is con tinued with it. dma interrupt request generation timing when the dmai transfer counter underflowed dma startup data transfer is initiated each time a dma request is generated when the dmae bit in the dmaicon register is set to 1 (enabled). dma shutdown single transfer ? when the dmae bit is set to 0 (disabled) ? after the dmai transfer counter underflows repeat transfer when the dmae bit is set to 0 (disabled) when a data transfer is started after setting the dmae bit to 1 (en abled), the forward address pointer is reloaded with the value of the sari or the dari pointer whichever is specified to be in the forward direction and the dmai transfer counter is reloaded with the value of the dmai transfer counter reload register. n otes: 1. dma transfer is not effective to any interrupt. dma transfer is affected neither by the i flag nor by the interrupt control register. 2. the selectable causes of dma requests differ with each channel. 3. make sure that no dmac-related registers (addresses 0020 16 to 003f 16 ) are accessed by the dmac.
11. dmac page 84 9 2 3 f o 7 0 0 2 , 5 1 . b e f 0 0 . 2 . v e r 0 0 2 0 - 2 0 2 0 b 9 0 j e r ) t 6 2 / c 6 1 m , b 6 2 / c 6 1 m , a 6 2 / c 6 1 m ( p u o r g a 6 2 / c 6 1 m figure 11.2 dm0sl register dma0 request cause select register symbol address after reset dm0sl 03b8 16 00 16 function bit symbol b7 b6 b5 b4 b3 b2 b1 b0 dma request cause select bit dsel0 rw dsel1 dsel2 dsel3 nothing is assigned. when write, set to 0 . when read, its content is 0 . software dma request bit a dma request is generated by setting this bit to 1 when the dms bit is 0 (basic cause) and the dsel3 to dsel0 bits are 0001 2 (software trigger). the value of this bit when read is 0 . dsr dsel3 to dsel0 dms=0(basic cause of request) dms=1(extended cause of request) 0 0 0 0 2 falling edge of int0 pin C 0 0 0 1 2 software trigger C 0 0 1 0 2 timer a0 C 0 0 1 1 2 timer a1 C 0 1 0 0 2 timer a2 C 0 1 0 1 2 timer a3 C 0 1 1 0 2 timer a4 two edges of int0 pin 0 1 1 1 2 timer b0 C 1 0 0 0 2 timer b1 C 1 0 0 1 2 timer b2 C 1 0 1 0 2 uart0 transmit C 1 0 1 1 2 uart0 receive C 1 1 0 0 2 uart2 transmit C 1 1 0 1 2 uart2 receive C 1 1 1 0 2 a/d conversion C 1 1 1 1 2 uart1 transmit C bit name dma request cause expansion select bit dms 0: basic cause of request 1: extended cause of request rw rw rw rw rw rw (b5-b4) refer to note note: 1. the causes of dma0 requests can be selected by a combination of dms bit and dsel3 to dsel0 bits in the manner described below.
11. dmac page 85 9 2 3 f o 7 0 0 2 , 5 1 . b e f 0 0 . 2 . v e r 0 0 2 0 - 2 0 2 0 b 9 0 j e r ) t 6 2 / c 6 1 m , b 6 2 / c 6 1 m , a 6 2 / c 6 1 m ( p u o r g a 6 2 / c 6 1 m figure 11.3 dm1sl register, dm0con register, and dm1con register dmai control register (i=0,1) symbol address after reset dm0con 002c 16 00000x00 2 dm1con 003c 16 00000x00 2 bit name function bit symbol transfer unit bit select bit b7 b6 b5 b4 b3 b2 b1 b0 0 : 16 bits 1 : 8 bits dmbit dmasl dmas dmae repeat transfer mode select bit 0 : single transfer 1 : repeat transfer dma request bit 0 : dma not requested 1 : dma requested 0 : disabled 1 : enabled 0 : fixed 1 : forward dma enable bit source address direction select bit (2) destination address direction select bit (2) 0 : fixed 1 : forward dsd dad nothing is assigned. when write, set to 0 . when read, its content is 0 . (1) dma1 request cause select register symbol address after reset dm1sl 03ba 16 00 16 function bit symbol b7 b6 b5 b4 b3 b2 b1 b0 dma request cause select bit dsel0 rw dsel1 dsel2 dsel3 software dma request bit dsr dsel3 to dsel0 dms=0(basic cause of request) dms=1(extended cause of request) 0 0 0 0 2 falling edge of int1 pin C 0 0 0 1 2 software trigger C 0 0 1 0 2 timer a0 C 0 0 1 1 2 timer a1 C 0 1 0 0 2 timer a2 C 0 1 0 1 2 timer a3 C 0 1 1 0 2 timer a4 C 0 1 1 1 2 timer b0 two edges of int1 1 0 0 0 2 timer b1 C 1 0 0 1 2 timer b2 C 1 0 1 0 2 uart0 transmit C 1 0 1 1 2 uart0 receive C 1 1 0 0 2 uart2 transmit C 1 1 0 1 2 uart2 receive/ack2 C 1 1 1 0 2 a/d conversion C 1 1 1 1 2 uart1 receive C bit name dma request cause expansion select bit dms rw rw rw rw rw rw (b5-b4) rw rw rw rw rw rw rw (b7-b6) nothing is assigned. when write, set to 0 . when read, its content is 0 . a dma request is generated by setting this bit to 1 when the dms bit is 0 (basic cause) and the dsel3 to dsel0 bits are 0001 2 (software trigger). the value of this bit when read is 0 . 0: basic cause of request 1: extended cause of request refer to note note: 1. the causes of dma1 requests can be selected by a combination of dms bit and dsel3 to dsel0 bits in the manner described below. notes: 1.the dmas bit can be set to 0 by writing 0 in a program (this bit remains unchanged even if 1 is written). 2. at least one of the dad and dsd bits must be 0 (address direction fixed).
11. dmac page 86 9 2 3 f o 7 0 0 2 , 5 1 . b e f 0 0 . 2 . v e r 0 0 2 0 - 2 0 2 0 b 9 0 j e r ) t 6 2 / c 6 1 m , b 6 2 / c 6 1 m , a 6 2 / c 6 1 m ( p u o r g a 6 2 / c 6 1 m figure 11.4 sar0 and sar1, dar0 and dar1, tcr0 and tcr1 registers b7 b0 b7 b0 (b8) (b15) function set the transfer count minus 1. the written value is stored in the dmai transfer counter reload register, and when the dmae bit in the dmicon register is set to 1 (dma enabled) or the dmai transfer counter underflows when the dmasl bit in the dmicon register is 1 (repeat transfer), the value of the dmai transfer counter reload register is transferred to the dmai transfer counter. when read, the dmai transfer counter is read. symbol address after reset tcr0 0029 16 , 0028 16 indeterminate tcr1 0039 16 , 0038 16 indeterminate dmai transfer counter (i = 0, 1 ) setting range 0000 16 to ffff 16 b7 (b23) b3 b0 b7 b0 b7 b0 (b8) (b16)(b15) (b19) function rw set the source address of transfer symbol address after reset sar0 0022 16 to 0020 16 indeterminate sar1 0032 16 to 0030 16 indeterminate dmai source pointer (i = 0, 1) (1) setting range 00000 16 to fffff 16 nothing is assigned. when write, set 0 . when read, these contents are 0 . symbol address after reset dar0 0026 16 to 0024 16 indeterminate dar1 0036 16 to 0034 16 indeterminate b3 b0 b7 b0 b7 b0 (b8) (b15) (b16) (b19) function set the destination address of transfer dmai destination pointer (i = 0, 1) (1) setting range 00000 16 to fffff 16 b7 (b23) rw rw rw rw rw nothing is assigned. when write, set 0 . when read, these contents are 0 . note: 1. if the dsd bit in the dmicon register is 0 (fixed), this register can only be written to when the dmae bit in the dmicon register is 0 (dma disabled). if the dsd bit is set to 1 (forward direction), this register can be written to at any time. if the dsd bit is set to 1 and the dmae bit is 1 (dma enabled), the dmai forward address pointer can be read from this register. otherwise, the value written to it can be read. note: 1. if the dad bit in the dmicon register is 0 (fixed), this register can only be written to when the dmae bit in the dmicon register is 0 (dma disabled). if the dad bit is set to 1 (forward direction), this register can be written to at any time. if the dad bit is set to 1 and the dmae bit is 1 (dma enabled), the dmai forward address pointer can be read from this register. otherwise, the value written to it can be read.
11. dmac page 87 9 2 3 f o 7 0 0 2 , 5 1 . b e f 0 0 . 2 . v e r 0 0 2 0 - 2 0 2 0 b 9 0 j e r ) t 6 2 / c 6 1 m , b 6 2 / c 6 1 m , a 6 2 / c 6 1 m ( p u o r g a 6 2 / c 6 1 m 11.1 transfer cycles the transfer cycle consists of a memory or sfr read (source read) bus cycle and a write (destination write) bus cycle. the number of read and write bus cycles is affected by the source and destination addresses of transfer. furthermore, the bus cycle itself is extended by a software wait. 11.1.1 effect of source and destination addresses if the transfer unit is 16 bits and the source address of transfer begins with an odd address, the source read cycle consists of one more bus cycle than when the source address of transfer begins with an even address. similarly, if the transfer unit is 16 bits and the destination address of transfer begins with an odd address, the destination write cycle consists of one more bus cycle than when the destination address of transfer begins with an even address. 11.1.2 effect of software wait for memory or sfr accesses in which one or more software wait states are inserted, the number of bus cycles required for that access increases by an amount equal to software wait states. figure 11.1.1 shows the example of the cycles for a source read. for convenience, the destination write cycle is shown as one cycle and the source read cycles for the different conditions are shown. in reality, the destination write cycle is subject to the same conditions as the source read cycle, with the transfer cycle changing accordingly. when calculating transfer cycles, take into consideration each condition for the source read and the destination write cycle, respectively. for example, when data is transferred in 16 bit units and when both the source address and destination address are an odd address ((2) in figure 11.1.1), two source read bus cycles and two destination write bus cycles are required.
11. dmac page 88 9 2 3 f o 7 0 0 2 , 5 1 . b e f 0 0 . 2 . v e r 0 0 2 0 - 2 0 2 0 b 9 0 j e r ) t 6 2 / c 6 1 m , b 6 2 / c 6 1 m , a 6 2 / c 6 1 m ( p u o r g a 6 2 / c 6 1 m figure 11.1.1 transfer cycles for source read cpu clock address bus rd signal wr signal data bus cpu use cpu use cpu use cpu use source source destination destination dummy cycle dummy cycle (1) when the transfer unit is 8 or 16 bits and the source of transfer is an even address address bus rd signal wr signal data bus cpu use cpu use cpu use cpu use source source destination destination dummy cycle dummy cycle (3) when the source read cycle under condition (1) has one wait state inserted address bus rd signal wr signal data bus cpu use cpu use cpu use cpu use source source destination destination dummy cycle dummy cycle source + 1 source + 1 (2) when the transfer unit is 16 bits and the source address of transfer is an odd address address bus rd signal wr signal data bus cpu use cpu use cpu use cpu use source source destination destination dummy cycle dummy cycle source + 1 source + 1 (4) when the source read cycle under condition (2) has one wait state inserted cpu clock cpu clock cpu clock note: 1. the same timing changes occur with the respective conditions at the destination as at the source.
11. dmac page 89 9 2 3 f o 7 0 0 2 , 5 1 . b e f 0 0 . 2 . v e r 0 0 2 0 - 2 0 2 0 b 9 0 j e r ) t 6 2 / c 6 1 m , b 6 2 / c 6 1 m , a 6 2 / c 6 1 m ( p u o r g a 6 2 / c 6 1 m 11.2. dma transfer cycles any combination of even or odd transfer read and write adresses is possible. table 11.2.1 shows the number of dma transfer cycles. table 11.2.2 shows the coefficient j, k. the number of dmac transfer cycles can be calculated as follows: no. of transfer cycles per transfer unit = no. of read cycles x j + no. of write cycles x k table 11.2.1 dma transfer cycles table 11.2.2 coefficient j, k transfer unit access address no. of read cycles no. of write cycles 8-bit transfers even 1 1 (dmbit= 1 ) odd 1 1 16-bit transfers even 1 1 (dmbit= 0 ) odd 2 2 internal area internal rom, ram sfr no wait with wait 1 1 2 2 2 2 j k 1 wait 2 wait 3 3 (1) (1) note: 1. depends on the set value of pm20 bit in pm2 register.
11. dmac page 90 9 2 3 f o 7 0 0 2 , 5 1 . b e f 0 0 . 2 . v e r 0 0 2 0 - 2 0 2 0 b 9 0 j e r ) t 6 2 / c 6 1 m , b 6 2 / c 6 1 m , a 6 2 / c 6 1 m ( p u o r g a 6 2 / c 6 1 m 11.3 dma enable when a data transfer starts after setting the dmae bit in dmicon register (i = 0, 1) to 1 (enabled), the dmac operates as follows: (1) reload the forward address pointer with the sari register value when the dsd bit in the dmicon register is 1 (forward) or the dari register value when the dad bit in the dmicon register is 1 (forward). (2) reload the dmai transfer counter with the dmai transfer counter reload register value. if the dmae bit is set to 1 again while it remains set, the dmac performs the above operation. however, if a dma request may occur simultaneously when the dmae bit is being written, follow the steps below. step 1: write 1 to the dmae bit and dmas bit in dmicon register simultaneously. step 2: make sure that the dmai is in an initial state as described above (1) and (2) in a program. if the dmai is not in an initial state, the above steps should be repeated. 11.4 dma request the dmac can generate a dma request as triggered by the cause of request that is selected with the dms and dsel3 to dsel0 bits in the dmisl register (i = 0, 1) on either channel. table 11.4.1 shows the timing at which the dmas bit changes state. whenever a dma request is generated, the dmas bit is set to 1 (dma requested) regardless of whether or not the dmae bit is set. if the dmae bit was set to 1 (enabled) when this occurred, the dmas bit is set to 0 (dma not requested) immediately before a data transfer starts. this bit cannot be set to 1 in a program (it can only be set to 0 ). the dmas bit may be set to 1 when the dms or the dsel3 to dsel0 bits change state. therefore, always be sure to set the dmas bit to 0 after changing the dms or the dsel3 to dsel0 bits. because if the dmae bit is 1 , a data transfer starts immediately after a dma request is generated, the dmas bit in almost all cases is 0 when read in a program. read the dmae bit to determine whether the dmac is enabled. table 11.4.1 timing at which the dmas bit changes state dma factor software trigger peripheral function timing at which the bit is set to 1 timing at which the bit is set to 0 dmas bit in the dmicon register when the dsr bit in the dmisl register is set to 1 when the interrupt control register for the peripheral function that is selected by the dsel3 to dsel0 and dms bits in the dmisl register has its ir bit set to 1 ? immediately before a data transfer starts ? when set by writing 0 in a program
11. dmac page 91 9 2 3 f o 7 0 0 2 , 5 1 . b e f 0 0 . 2 . v e r 0 0 2 0 - 2 0 2 0 b 9 0 j e r ) t 6 2 / c 6 1 m , b 6 2 / c 6 1 m , a 6 2 / c 6 1 m ( p u o r g a 6 2 / c 6 1 m 11.5 channel priority and dma transfer timing if both dma0 and dma1 are enabled and dma transfer request signals from dma0 and dma1 are de- tected active in the same sampling period (one period from a falling edge to the next falling edge of cpu clock), the dmas bit on each channel is set to 1 (dma requested) at the same time. in this case, the dma requests are arbitrated according to the channel priority, dma0 > dma1. the following describes dmac operation when dma0 and dma1 requests are detected active in the same sampling period. figure 11.5.1 shows an example of dma transfer effected by external factors. dma0 request having priority is received first to start a transfer when a dma0 request and dma1 request are generated simultanelously. after one dma0 transfer is completed, a bus arbitration is returned to the cpu. when the cpu has completed one bus access, a dma1 transfer starts. after one dma1 transfer is completed, the bus arbitration is again returned to the cpu. in addition, dma requsts cannot be counted up since each channel has one dmas bit. therefore, when dma requests, as dma1 in figure 11.5.1, occurs more than one time, the dams bit is set to "0" as soon as getting the bus arbitration. the bus arbitration is returned to the cpu when one transfer is completed. figure 11.5.1 dma transfer by external factors aaaa aaaa dma0 aaaa aaaa dma1 dma0 request bit dma1 request bit aaa aaaaa aa aa aaaaa aa aa cpu int0 int1 obtainment of the bus right an example where dma requests for external causes are detected active at the same cpu clock
12. timer page 92 9 2 3 f o 7 0 0 2 , 5 1 . b e f 0 0 . 2 . v e r 0 0 2 0 - 2 0 2 0 b 9 0 j e r ) t 6 2 / c 6 1 m , b 6 2 / c 6 1 m , a 6 2 / c 6 1 m ( p u o r g a 6 2 / c 6 1 m figure 12.1. timer a configuration 12. timer note the tb2in pin is not available in the 42-pin package. do not use functions associated with the tb2in pin. eight 16-bit timers, each capable of operating independently of the others, can be classified by function as either timer a (five) and timer b (three). the count source for each timer acts as a clock, to control such timer operations as counting, reloading, etc. figures 12.1 and 12.2 show block diagrams of timer a and timer b configuration, respectively. ? timer mode ? one-shot timer mode ? pulse width measuring (pwm) mode ? timer mode ? one-shot timer mode ? pwm mode ? timer mode ? one-shot timer mode ? pwm mode ? timer mode ? one-shot timer mode ? pwm mode ? timer mode ? one-shot timer mode ? pwm mode ? event counter mode ? event counter mode ? event counter mode ? event counter mode ? event counter mode ta0 in ta1 in ta2 in ta3 in ta4 in timer a0 timer a1 timer a2 timer a3 timer a4 f 8 f 32 f c32 timer a0 interrupt timer a1 interrupt timer a2 interrupt timer a3 interrupt timer a4 interrupt noise filter noise filter noise filter noise filter noise filter 1/32 f c32 1/8 1/4 f 1 or f 2 f 8 f 32 ? main clock ? pll clock ? on-chip oscillator clock x cin reset clock prescaler timer b2 overflow or underflow 1/2 f 1 f 2 pclk0 bit = "0" pclk0 bit = "1" f 1 or f 2 set the cpsr bit in the cpsrf register to 1 (= prescaler reset)
12. timer page 93 9 2 3 f o 7 0 0 2 , 5 1 . b e f 0 0 . 2 . v e r 0 0 2 0 - 2 0 2 0 b 9 0 j e r ) t 6 2 / c 6 1 m , b 6 2 / c 6 1 m , a 6 2 / c 6 1 m ( p u o r g a 6 2 / c 6 1 m figure 12.2. timer b configuration ? event counter mode ? event counter mode ? event counter mode ? timer mode ? pulse width measuring mode, pulse period measuring mode ? timer mode ? pulse width measuring mode, pulse period measuring mode ? timer mode ? pulse width measuring mode, pulse period measuring mode tb0 in tb1 in tb2 in timer b0 timer b1 timer b2 f 8 f 32 f c32 timer b0 interrupt noise filter noise filter noise filter 1/32 f c32 x cin reset clock prescaler timer b2 overflow or underflow ( to timer a count source) timer b1 interrupt timer b2 interrupt 1/ 8 1/ 4 f 8 f 32 1/ 2 f 1 or f 2 ? main clock ? pll clock ? on-chip oscillator clock f 1 f 2 pclk0 bit = "0" pclk0 bit = "1" f 1 or f 2 set the cpsr bit in the cpsrf register to 1 (= prescaler reset)
12. timer page 94 9 2 3 f o 7 0 0 2 , 5 1 . b e f 0 0 . 2 . v e r 0 0 2 0 - 2 0 2 0 b 9 0 j e r ) t 6 2 / c 6 1 m , b 6 2 / c 6 1 m , a 6 2 / c 6 1 m ( p u o r g a 6 2 / c 6 1 m 12.1 timer a figure 12.1.1 shows a block diagram of the timer a. figures 12.1.2 to 12.1.4 show registers related to the timer a. the timer a supports the following four modes. except in event counter mode, timers a0 to a4 all have the same function. use the tmod1 to tmod0 bits in the taimr register (i = 0 to 4) to select the desired mode. ? timer mode: the timer counts an internal count source. ? event counter mode: the timer counts pulses from an external device or overflows and underflows of other timers. ? one-shot timer mode: the timer outputs a pulse only once before it reaches the minimum count 0000 16 . ? pulse width modulation (pwm) mode: the timer outputs pulses in a given width successively. figure 12.1.2. ta0mr to ta4mr registers tabsr register up-count/down-count tai addresses taj tak timer a0 0387 16 - 0386 16 timer a4 timer a1 timer a1 0389 16 - 0388 16 timer a0 timer a2 timer a2 038b 16 - 038a 16 timer a1 timer a3 timer a3 038d 16 - 038c 16 timer a2 timer a4 timer a4 038f 16 - 038e 16 timer a3 timer a 0 always counts down except in event counter mode reload register counter low-order 8 bits high-order 8 bits clock source selection ? timer (gate function) ? timer ? one shot ? pwm f 1 or f 2 f 8 f 32 tai in (i = 0 to 4) tb2 overflow ? event counter f c32 clock selection taj overflow (j = i C 1. note, however, that j = 4 when i = 0) pulse output toggle flip-flop tai out (i = 0 to 4 ) data bus low-order bits data bus high-order bits udf register down count tak overflow (k = i + 1. note, however, that k = 0 when i = 4) polarity selection to external trigger circuit (1) (1) note: 1. overflow or underflow clock selection figure 12.1.1. timer a block diagram timer ai mode register (i=0 to 4) symbol address after reset ta0mr to ta4mr 0396 16 to 039a 16 00 16 bit name function bit symbol rw b7 b6 b5 b4 b3 b2 b1 b0 0 0 : timer mode 0 1 : event counter mode 1 0 : one-shot timer mode 1 1 : pulse width modulation (pwm) mode b1 b0 tck1 mr3 mr2 mr1 tmod1 mr0 tmod0 tck0 function varies with each operation mode count source select bit operation mode select bi t rw rw rw rw rw rw rw rw function varies with each operation mode
12. timer page 95 9 2 3 f o 7 0 0 2 , 5 1 . b e f 0 0 . 2 . v e r 0 0 2 0 - 2 0 2 0 b 9 0 j e r ) t 6 2 / c 6 1 m , b 6 2 / c 6 1 m , a 6 2 / c 6 1 m ( p u o r g a 6 2 / c 6 1 m figure 12.1.3. ta0 to ta4 registers, tabsr register, and udf register symbol address after reset ta0 0387 16 , 0386 16 indeterminate ta1 0389 16 , 0388 16 indeterminate ta2 038b 16 , 038a 16 indeterminate ta3 038d 16 , 038c 16 indeterminate ta4 038f 16 , 038e 16 indeterminate b7 b0 b7 b0 (b15) (b8) timer ai register (i= 0 to 4) (1) rw divide the count source by n + 1 where n = set value function setting range divide the count source by ffff 16 C n + 1 where n = set value when counting up or by n + 1 when counting down divide the count source by n where n = set value and cause the timer to stop modify the pulse width as follows: pwm period: (2 16 C 1) / fj high level pwm pulse width: n / fj where n = set value, fj = count source frequency 0000 16 to fffe 16 (3, 4) 00 16 to fe 16 (high-order address) 00 16 to ff 16 (low-order address) timer a4 up/down flag timer a3 up/down flag timer a2 up/down flag timer a1 up/down flag timer a0 up/down flag timer a2 two-phase pulse signal processing select bit timer a3 two-phase pulse signal processing select bit timer a4 two-phase pulse signal processing select bit symbol address after reset udf 0384 16 00 16 ta4p ta3p ta2p up/down flag (1) bit name function bit symbol b7 b6 b5 b4 b3 b2 b1 b0 ta4ud ta3ud ta2ud ta1ud ta0ud 0 : down count 1 : up count enabled by setting the taimr register s mr2 bit to 0 (= switching source in udf register) during event counter mode. 0 : two-phase pulse signal processing disabled 1 : two-phase pulse signal processing enabled symbol address after reset tabsr 0380 16 00 16 count start fla g bit name function bit symbol rw b7 b6 b5 b4 b3 b2 b1 b0 timer b2 count start flag timer b1 count start flag timer b0 count start flag timer a4 count start flag timer a3 count start flag timer a2 count start flag timer a1 count start flag timer a0 count start flag 0 : stops counting 1 : starts counting tb2s tb1s tb0s ta4s ta3s ta2s ta1s ta0s rw rw wo wo wo rw rw rw rw rw rw rw rw rw rw rw rw rw rw wo wo wo timer mode event counter mode one-shot timer mode pulse width modulation mode (16-bit pwm) pulse width modulation mode (8-bit pwm) 0000 16 to ffff 16 0000 16 to ffff 16 0000 16 to ffff 16 (2, 4) mode modify the pulse width as follows: pwm period: (2 8 C 1) x (m + 1)/ fj high level pwm pulse width: (m + 1)n / fj where n = high-order address set value, m = low-order address set value, fj = count source frequency (3, 4) (2, 3) (5) notes: 1. the register must be accessed in 16 bit units. 2.: if the tai register is set to 0000 16 , the counter does not work and timer ai interrupt requests are not generated either. furthermore, if pulse output is selected, no pulses are output from the taiout pin. 3. if the tai register is set to 0000 16 , the pulse width modulator does not work, the output level on the taiout pin remains low, and timer ai interrupt requests are not generated either. the same applies when the 8 high-order bits of the timer tai register are set to 00 16 while operating as an 8-bit pulse width modulator. 4. use the mov instruction to write to the tai register. 5. the timer counts pulses from an external device or overflows or underflows in other timers. notes: 1. use mov instruction to write to this register. 2. make sure the port direction bits for the ta2 in to ta4i n and ta2 out to ta4 out pins are set to 0 ( in p ut mode ) .
12. timer page 96 9 2 3 f o 7 0 0 2 , 5 1 . b e f 0 0 . 2 . v e r 0 0 2 0 - 2 0 2 0 b 9 0 j e r ) t 6 2 / c 6 1 m , b 6 2 / c 6 1 m , a 6 2 / c 6 1 m ( p u o r g a 6 2 / c 6 1 m figure 12.1.4. onsf register, trgsr register, and cpsrf register symbol address after reset cpsrf 0381 16 0xxxxxxx 2 clock prescaler reset flag bit name function bit symbol b7 b6 b5 b4 b3 b2 b1 b0 clock prescaler reset flag setting this bit to 1 initializes the prescaler for the timekeeping clock. (when read, its content is 0 .) cpsr nothing is assigned. when write, set to 0 . when read, their contents are indeterminate. ta1tgl symbol address after reset trgsr 0383 16 00 16 timer a1 event/trigger select bit 0 0 : input on ta1 in is selected (1) 0 1 : tb2 overflow is selected 1 0 : ta0 overflow is selected 1 1 : ta2 overflow is selected trigger select register bit name function bit symbol b7 b6 b5 b4 b3 b2 b1 b0 0 0 : input on ta2 in is selected (1) 0 1 : tb2 overflow is selected 1 0 : ta1 overflow is selected 1 1 : ta3 overflow is selected 0 0 : input on ta3 in is selected (1) 0 1 : tb2 overflow is selected 1 0 : ta2 overflow is selected 1 1 : ta4 overflow is selected 0 0 : input on ta4 in is selected (1) 0 1 : tb2 overflow is selected 1 0 : ta3 overflow is selected 1 1 : ta0 overflow is selected timer a2 event/trigger select bit timer a3 event/trigger select bit timer a4 event/trigger select bit ta1tgh ta2tgl ta2tgh ta3tgl ta3tgh ta4tgl ta4tg h b1 b0 b3 b2 b5 b4 b7 b6 ta1os ta2os ta0os one-shot start flag symbol address after reset onsf 0382 16 00 16 timer a0 one-shot start flag timer a1 one-shot start flag timer a2 one-shot start flag timer a3 one-shot start flag timer a4 one-shot start flag ta3os ta4os bit name function bit symbol b7 b6 b5 b4 b3 b2 b1 b0 ta0tg l ta0tgh 0 0 : input on ta0 in is selected 0 1 : tb2 overflow is selected 1 0 : ta4 overflow is selected 1 1 : ta1 overflow is selected timer a0 event/trigger select bit b7 b6 rw the timer starts counting by setting this bit to 1 while the tmod1 to tmod0 bits in the taimr register (i = 0 to 4) is set to 10 2 (= one- shot timer mode) and the mr2 bit in the taimr register is set to 0 (=taios bit enabled). when read, its content is 0 . z-phase input enable bit tazie 0 : z-phase input disabled 1 : z-phase input enabled rw rw rw rw rw rw rw rw rw rw rw rw rw rw rw rw rw rw rw (b6-b0) (2) (2) (2) (1) (2) (2) (2) (2) (2) (2) (2) (2) (2) (2) (2) (2) notes: 1. make sure the port direction bits for the ta1 in to ta4 in pins are set to 0 (= input mode). 2. overflow or underflow. notes: 1. make sure the pd7_1 bit in the pd7 register is set to 0 (= input mode). 2. overflow or underflow.
12. timer page 97 9 2 3 f o 7 0 0 2 , 5 1 . b e f 0 0 . 2 . v e r 0 0 2 0 - 2 0 2 0 b 9 0 j e r ) t 6 2 / c 6 1 m , b 6 2 / c 6 1 m , a 6 2 / c 6 1 m ( p u o r g a 6 2 / c 6 1 m item specification count source f 1 , f 2 , f 8 , f 32 , f c32 count operation ? down-count ? when the timer underflows, it reloads the reload register contents and continues counting divide ratio 1/(n+1) n: set value of tai register (i= 0 to 4) 0000 16 to ffff 16 count start condition set tais bit in the tabsr register to 1 (= start counting) count stop condition set tais bit to 0 (= stop counting) interrupt request generation timing timer underflow tai in pin function i/o port or gate input tai out pin function i/o port or pulse output read from timer count value can be read by reading tai register write to timer ? when not counting and until the 1st count source is input after counting start value written to tai register is written to both reload register and counter ? when counting (after 1st count source input) value written to tai register is written to only reload register (transferred to counter when reloaded next) select function ? gate function counting can be started and stopped by an input signal to tai in pin ? pulse output function whenever the timer underflows, the output polarity of tai out pin is inverted. when not counting, the pin outputs a low. 12.1.1. timer mode in timer mode, the timer counts a count source generated internally (see table 12.1.1.1). figure 1.2.1.1.1 shows taimr register in timer mode. table 12.1.1.1. specifications in timer mode timer ai mode register (i=0 to 4) symbol address after reset ta0mr to ta4mr 0396 16 to 039a 16 00 16 bit name function bit symbol rw b7 b6 b5 b4 b3 b2 b1 b0 operation mode select bit 0 0 : timer mode b1 b0 tmod1 tmod0 mr0 pulse output function select bit 0 : pulse is not output (ta iout pin is a normal port pin) 1 : pulse is output (ta iout pin is a pulse output pin) gate function select bit 0 0 : gate function not available 0 1 : (tai in pin functions as i/o port) 1 0 : counts while input on the tai in pin is low (1) 1 1 : counts while input on the tai in pin is high (1) b4 b3 mr2 mr1 mr3 must be set to 0 in timer mode 0 0 : f 1 or f 2 0 1 : f 8 1 0 : f 32 1 1 : f c32 b7 b6 tck1 tck0 count source select bit 00 0 rw rw rw rw rw rw rw rw } note: 1.the port direction bit for the tai in pin must be set to 0 (= input mode). figure 12.1.1.1. timer ai mode register in timer mode
12. timer page 98 9 2 3 f o 7 0 0 2 , 5 1 . b e f 0 0 . 2 . v e r 0 0 2 0 - 2 0 2 0 b 9 0 j e r ) t 6 2 / c 6 1 m , b 6 2 / c 6 1 m , a 6 2 / c 6 1 m ( p u o r g a 6 2 / c 6 1 m item specification count source ? external signals input to tai in pin (i=0 to 4) (effective edge can be selected in program) ? timer b2 overflows or underflows, timer aj (j=i-1, except j=4 if i=0) overflows or underflows, timer ak (k=i+1, except k=0 if i=4) overflows or underflows count operation ? up-count or down-count can be selected by external signal or program ? when the timer overflows or underflows, it reloads the reload register con- tents and continues counting. when operating in free-running mode, the timer continues counting without reloading. divided ratio 1/ (ffff 16 - n + 1) for up-count 1/ (n + 1) for down-count n : set value of tai register 0000 16 to ffff 16 count start condition set tais bit in the tabsr register to 1 (= start counting) count stop condition set tais bit to 0 (= stop counting) interrupt request generation timing timer overflow or underflow tai in pin function i/o port or count source input tai out pin function i/o port, pulse output, or up/down-count select input read from timer count value can be read by reading tai register write to timer ? when not counting and until the 1st count source is input after counting start value written to tai register is written to both reload register and counter ? when counting (after 1st count source input) value written to tai register is written to only reload register (transferred to counter when reloaded next) select function ? free-run count function even when the timer overflows or underflows, the reload register content is not reloaded to it ? pulse output function whenever the timer underflows or underflows, the output polarity of tai out pin is inverted . when not counting, the pin outputs a low. 12.1.2. event counter mode in event counter mode, the timer counts pulses from an external device or overflows and underflows of other timers. timers a2, a3 and a4 can count two-phase external signals. table 12.1.2.1 lists specifica- tions in event counter mode (when not processing two-phase pulse signal). table 12.1.2.2 lists specifica- tions in event counter mode (when processing two-phase pulse signal with the timers a2, a3 and a4). figure 12.1.2.1 shows taimr register in event counter mode (when not processing two-phase pulse signal). figure 12.1.2.2 shows ta2mr to ta4mr registers in event counter mode (when processing two- phase pulse signal with the timers a2, a3 and a4). table 12.1.2.1. specifications in event counter mode (when not processing two-phase pulse signal)
12. timer page 99 9 2 3 f o 7 0 0 2 , 5 1 . b e f 0 0 . 2 . v e r 0 0 2 0 - 2 0 2 0 b 9 0 j e r ) t 6 2 / c 6 1 m , b 6 2 / c 6 1 m , a 6 2 / c 6 1 m ( p u o r g a 6 2 / c 6 1 m figure 12.1.2.1. taimr register in event counter mode (when not using two-phase pulse signal processing) symbol address after reset ta0mr to ta4mr 0396 16 to 039a 16 00 16 w r b7 b6 b5 b4 b3 b2 b1 b0 operation mode select bit 0 1 : event counter mode (1) b1 b0 tmod0 mr0 pulse output function select bit 0 : pulse is not output (ta iout pin functions as i/o port) 1 : pulse is output (tai out pin functions as pulse output pin) count polarity select bit (2) mr2 mr1 mr3 must be set to 0 in event counter mode tck0 count operation type select bit 01 0 0 : counts external signal's falling edge 1 : counts external signal's rising edge up/down switching cause select bit 0 : udf register 1 : input signal to ta iout pin (3) 0 : reload type 1 : free-run type bit symbol bit name function rw tck1 can be 0 or 1 when not using two-phase pulse signal processing tmod1 timer ai mode register (i=0 to 4) (when not using two-phase pulse signal processing) rw rw rw rw rw rw rw rw notes: 1. during event counter mode, the count source can be selected using the onsf and trgsr registers. 2. effective when the taitgh and taitgl bits in the onsf or trgsr register are 00 2 (tai in pin input). 3. count down when input on tai out pin is low or count up when input on that pin is high. the port direction bit for tai out pin must be set to 0 (= input mode).
12. timer page 100 9 2 3 f o 7 0 0 2 , 5 1 . b e f 0 0 . 2 . v e r 0 0 2 0 - 2 0 2 0 b 9 0 j e r ) t 6 2 / c 6 1 m , b 6 2 / c 6 1 m , a 6 2 / c 6 1 m ( p u o r g a 6 2 / c 6 1 m item specification count source ? two-phase pulse signals input to tai in or tai out pins (i = 2 to 4) count operation ? up-count or down-count can be selected by two-phase pulse signal ? when the timer overflows or underflows, it reloads the reload register con- tents and continues counting. when operating in free-running mode, the timer continues counting without reloading. divide ratio 1/ (ffff 16 - n + 1) for up-count 1/ (n + 1) for down-count n : set value of tai register 0000 16 to ffff 16 count start condition set tais bit in the tabsr register to 1 (= start counting) count stop condition set tais bit to 0 (= stop counting) interrupt request generation timing timer overflow or underflow tai in pin function two-phase pulse input tai out pin function two-phase pulse input read from timer count value can be read by reading timer a2, a3 or a4 register write to timer ? when not counting and until the 1st count source is input after counting start value written to tai register is written to both reload register and counter ? when counting (after 1st count source input) value written to tai register is written to reload register (transferred to counter when reloaded next) select function (1) ? normal processing operation (timer a2 and timer a3) the timer counts up rising edges or counts down falling edges on taj in (j=2, 3) pin when input signals on taj out pin is h . ? multiply-by-4 processing operation (timer a3 and timer a4) if the phase relationship is such that tak in (k=3, 4) pin goes h when the input signal on tak out pin is h , the timer counts up rising and falling edges on tak out and tak in pins. if the phase relationship is such that tak in pin goes l when the input signal on tak out pin is h , the timer counts down rising and falling edges on tak out and tak in pins. table 12.1.2.2. specifications in event counter mode (when processing two-phase pulse signal with timers a2, a3 and a4) taj out up- count up- count up- count down- count down- count down- count taj in (j=2,3) tak out tak in (k=3,4) count up all edges count up all edges count down all edges count down all edges ? counter initialization by z-phase input (timer a3) the timer count value is initialized to 0 by z-phase input. note: 1. only timer a3 is selectable. timer a2 is fixed to normal processing operation, and timer a4 is fixed to multiply-by-4 processing operation.
12. timer page 101 9 2 3 f o 7 0 0 2 , 5 1 . b e f 0 0 . 2 . v e r 0 0 2 0 - 2 0 2 0 b 9 0 j e r ) t 6 2 / c 6 1 m , b 6 2 / c 6 1 m , a 6 2 / c 6 1 m ( p u o r g a 6 2 / c 6 1 m figure 12.1.2.2. ta2mr to ta4mr registers in event counter mode (when using two-phase pulse signal processing with timer a2, a3 or a4) timer ai mode register (i=2 to 4) (when using two-phase pulse signal processing) symbol address after reset ta2mr to ta4mr 0398 16 to 039a 16 00 16 b6 b5 b4 b3 b2 b1 b0 operation mode select bit 0 1 : event counter mode b1 b0 tmod1 tmod0 mr0 to use two-phase pulse signal processing, set this bit to 0 . mr2 mr1 mr3 tck1 tck0 01 0 bit name functio n rw count operation type select bit two-phase pulse signal processing operation select bit (1, 2) 0 : reload type 1 : free-run type 0 : normal processing operation 1 : multiply-by-4 processing operation 0 0 1 rw rw rw rw rw rw rw rw to use two-phase pulse signal processing, set this bit to 0 . to use two-phase pulse signal processing, set this bit to 1 . to use two-phase pulse signal processing, set this bit to 0 . bit symbol notes: 1. tck1 bit is valid for timer a3 mode register. no matter how this bit is set, timers a2 and a4 always operate in normal processing mode and x4 processing mode, respectively. 2. if two-phase pulse signal processing is desired, following register settings are required: ? set the taip bit in the udf register to 1 (two-phase pulse signal processing function enabled). ? set the taitgh and taitgl bits in the trgsr register to 00 2 (taiin pin input). ? set the port direction bits for tai in and tai out to 0 (input mode).
12. timer page 102 9 2 3 f o 7 0 0 2 , 5 1 . b e f 0 0 . 2 . v e r 0 0 2 0 - 2 0 2 0 b 9 0 j e r ) t 6 2 / c 6 1 m , b 6 2 / c 6 1 m , a 6 2 / c 6 1 m ( p u o r g a 6 2 / c 6 1 m m m+1 1 2 3 4 5 ta3 out (a phase) count source ta3 in (b phase) timer a3 int2 (z phase) (1) input equal to or greater than one clock cycle of count source note: 1. this timing diagram is for the case where the pol bit in the int2ic register is set to 1 (= rising edge). 12.1.2.1 counter initialization by two-phase pulse signal processing this function initializes the timer count value to 0 by z-phase (counter initialization) input during two- phase pulse signal processing. this function can only be used in timer a3 event counter mode during two-phase pulse signal process- _______ ing, free-running type, x4 processing, with z-phase entered from the int2 pin. counter initialization by z-phase input is enabled by writing 0000 16 to the ta3 register and setting the tazie bit in onsf register to 1 (= z-phase input enabled). counter initialization is accomplished by detecting z-phase input edge. the active edge can be cho- sen to be the rising or falling edge by using the pol bit in the int2ic register. the z-phase pulse width _______ applied to the int2 pin must be equal to or greater than one clock cycle of the timer a3 count source. the counter is initialized at the next count timing after recognizing z-phase input. figure 12.1.2.1.1 shows the relationship between the two-phase pulse (a phase and b phase) and the z phase. if timer a3 overflow or underflow coincides with the counter initialization by z-phase input, a timer a3 interrupt request is generated twice in succession. do not use the timer a3 interrupt when using this function. figure 12.1.2.1.1. two-phase pulse (a phase and b phase) and the z phase
12. timer page 103 9 2 3 f o 7 0 0 2 , 5 1 . b e f 0 0 . 2 . v e r 0 0 2 0 - 2 0 2 0 b 9 0 j e r ) t 6 2 / c 6 1 m , b 6 2 / c 6 1 m , a 6 2 / c 6 1 m ( p u o r g a 6 2 / c 6 1 m item specification count source f 1 , f 2 , f 8 , f 32 , f c32 count operation ? down-count ? when the counter reaches 0000 16 , it stops counting after reloading a new value ? if a trigger occurs when counting, the timer reloads a new count and restarts counting divide ratio 1/n n : set value of tai register 0000 16 to ffff 16 however, the counter does not work if the divide-by-n value is set to 0000 16 . count start condition tais bit in the tabsr register is set to 1 (start counting) and one of the following triggers occurs. ? external trigger input from the tai in pin ? timer b2 overflow or underflow, timer aj (j=i-1, except j=4 if i=0) overflow or underflow, timer ak (k=i+1, except k=0 if i=4) overflow or underflow ? the taios bit in the onsf register is set to 1 (= timer starts) count stop condition ? when the counter is reloaded after reaching 0000 16 ? tais bit is set to 0 (= stop counting) interrupt request generation timing when the counter reaches 0000 16 tai in pin function i/o port or trigger input tai out pin function i/o port or pulse output read from timer an indeterminate value is read by reading tai register write to timer ? when not counting and until the 1st count source is input after counting start value written to tai register is written to both reload register and counter ? when counting (after 1st count source input) value written to tai register is written to only reload register (transferred to counter when reloaded next) select function ? pulse output function the timer outputs a low when not counting and a high when counting. table 12.1.3.1. specifications in one-shot timer mode 12.1.3. one-shot timer mode in one-shot timer mode, the timer is activated only once by one trigger. (see table 12.1.3.1.) when the trigger occurs, the timer starts up and continues operating for a given period. figure 12.1.3.1 shows the taimr register in one-shot timer mode.
12. timer page 104 9 2 3 f o 7 0 0 2 , 5 1 . b e f 0 0 . 2 . v e r 0 0 2 0 - 2 0 2 0 b 9 0 j e r ) t 6 2 / c 6 1 m , b 6 2 / c 6 1 m , a 6 2 / c 6 1 m ( p u o r g a 6 2 / c 6 1 m figure 12.1.3.1. taimr register in one-shot timer mode bit name timer ai mode register (i=0 to 4) symbol address after reset ta0mr to ta4mr 396 16 to 039a 16 00 16 function bit symbol b7 b6 b5 b4 b3 b2 b1 b0 operation mode select bit 1 0 : one-shot timer mode b1 b0 tmod1 tmod0 mr0 pulse output function select bit 0 : pulse is not output (ta iout pin functions as i/o port) 1 : pulse is output (tai out pin functions as a pulse output pin ) mr2 mr1 mr3 must be set to 0 in one-shot timer mode 0 0 : f 1 or f 2 0 1 : f 8 1 0 : f 32 1 1 : f c32 b7 b6 tck1 tck0 count source select bit 10 0 0 : taios bit is enabled 1 : selected by taitgh to taitgl bits trigger select bit external trigger select bit (1) 0 : falling edge of input signal to tai in pin (2) 1 : rising edge of input signal to tai in pin (2) rw rw rw rw rw rw rw rw rw notes: 1. effective when the taitgh and taitgl bits in the onsf or trgsr register are 00 2 (tai in pin input). 2. the port direction bit for the tai in pin must be set to 0 (= input mode).
12. timer page 105 9 2 3 f o 7 0 0 2 , 5 1 . b e f 0 0 . 2 . v e r 0 0 2 0 - 2 0 2 0 b 9 0 j e r ) t 6 2 / c 6 1 m , b 6 2 / c 6 1 m , a 6 2 / c 6 1 m ( p u o r g a 6 2 / c 6 1 m 12.1.4. pulse width modulation (pwm) mode in pwm mode, the timer outputs pulses of a given width in succession (see table 12.1.4.1). the counter functions as either 16-bit pulse width modulator or 8-bit pulse width modulator. figure 12.1.4.1 shows taimr register in pulse width modulation mode. figures 12.1.4.2 and 12.1.4.3 show examples of how a 16-bit pulse width modulator operates and how an 8-bit pulse width modulator operates. table 12.1.4.1. specifications in pulse width modulation mode item specification count source f 1 , f 2 , f 8 , f 32 , f c32 count operation ? d own-count (operating as an 8-bit or a 16-bit pulse width modulator) ? the timer reloads a new value at a rising edge of pwm pulse and continues counting ? the timer is not affected by a trigger that occurs during counting 16-bit pwm ? high level width n / fj n : set value of tai register (i=o to 4) ? cycle time (2 16 -1) / fj fixed fj: count source frequency (f 1 , f 2 , f 8 , f 32 , f c32 ) 8-bit pwm ? high level width n x (m+1) / fj n : set value of tai register high-order address ? cycle time (2 8 -1) x (m+1) / fj m : set value of tai register low-order address count start condition ? tais bit in thetabsr register is set to 1 (= start counting) ? the tais bit is set to "1" and external trigger input from the tai in pin ? the tais bit is set to "1" and one of the following external triggers occurs timer b2 overflow or underflow, timer aj (j=i-1, except j=4 if i=0) overflow or underflow, timer ak (k=i+1, except k=0 if i=4) overflow or underflow count stop condition tais bit is set to 0 (= stop counting) interrupt request generation timing pwm pulse goes l tai in pin function i/o port or trigger input tai out pin function pulse output read from timer an indeterminate value is read by reading tai register write to timer ? when not counting and until the 1st count source is input after counting start value written to tai register is written to both reload register and counter ? when counting (after 1st count source input) value written to tai register is written to only reload register (transferred to counter when reloaded next)
12. timer page 106 9 2 3 f o 7 0 0 2 , 5 1 . b e f 0 0 . 2 . v e r 0 0 2 0 - 2 0 2 0 b 9 0 j e r ) t 6 2 / c 6 1 m , b 6 2 / c 6 1 m , a 6 2 / c 6 1 m ( p u o r g a 6 2 / c 6 1 m figure 12.1.4.1. taimr register in pulse width modulation mode bit name timer ai mode register (i= 0 to 4) symbol address after reset ta0mr to ta4mr 0396 16 to 039a 16 00 16 function bit symbol b7 b6 b5 b4 b3 b2 b1 b0 operation mode select bit 1 1 : pwm mode b1 b0 tmod1 tmod0 mr 0 mr2 mr 1 mr 3 0 0 : f 1 or f 2 0 1 : f 8 1 0 : f 32 1 1 : f c32 b7 b6 tck1 tck0 count source select bit r w 11 1 16/8-bit pwm mode select bit 0: functions as a 16-bit pulse width modulator 1: functions as an 8-bit pulse width modulator trigger select bit external trigger select bit (1) 0: falling edge of input signal to tai in pin (2) 1: rising edge of input signal to tai in pin (2) rw rw rw rw rw rw rw rw 0 : write 1 to tais bit in the tasf register 1 : selected by taitgh to taitgl bits 0: pulse is not output (taiout pin functions as i/o port) 1: pulse is output (taiout pin functions as a pulse output pin) pulse output funcion select bit notes: 1. effective when the taitgh and taitgl bits in the onsf or trgsr register are 00 2 (tai in pin input). 2. the port direction bit for the tai in pin must be set to 0 (= input mode).
12. timer page 107 9 2 3 f o 7 0 0 2 , 5 1 . b e f 0 0 . 2 . v e r 0 0 2 0 - 2 0 2 0 b 9 0 j e r ) t 6 2 / c 6 1 m , b 6 2 / c 6 1 m , a 6 2 / c 6 1 m ( p u o r g a 6 2 / c 6 1 m figure 12.1.4.2. example of 16-bit pulse width modulator operation figure 12.1.4.3. example of 8-bit pulse width modulator operation 1 / f i x (2 C 1) 16 count source input signal to ta iin pin pwm pulse output from ta iout pin trigger is not generated by this signal h h l l ir bit in the taiic register 1 0 f j : frequency of count source (f 1 , f 2 , f 8 , f 32 , f c32 ) i = 0 to 4 1 / f j x n set to 0 upon accepting an interrupt request or by writing in program notes: 1. n = 0000 16 to fffe 16 . 2. this timing diagram is for the case where the tai register is set to "0003 16 ", the taitgh and taitgl bits in the onsf or trgsr register is set to "00 2 " (tai in pin input), the mr1 bit in the taimr register is set to "1" (rising edge), and the mr2 bit in the taimr register is set to "1" (trigger selected by taitgh and taitgl bits). count source (1) input signal to ta iin pin underflow signal of 8-bit prescaler (2) pwm pulse output from ta iout pin h h h l l l 1 0 set to 0 upon accepting an interrupt request or by writing in program 1 / f j x (m + 1) x (2 C 1) 8 1 / f j x (m + 1) x n 1 / f j x (m + 1) ir bit in the taiic register f j : frequency of count source (f 1 , f 2 , f 8 , f 32 , f c32 ) i = 0 to 4 notes: 1. the 8-bit prescaler counts the count source. 2. the 8-bit pulse width modulator counts the 8-bit prescaler's underflow signal. 3. m = 00 16 to ff 16 ; n = 00 16 to fe 16 . 4. this timing diagram is for the case where the tai register is set to "0202 16 ", the taitgh and taitgl bits in the onsf or trgsr register is set to "00 2 " (tai in pin input), the mr1 bit in the taimr register is set to "0"(falling edge), and the mr2 bit in the taimr register is set to "1" (trigger selected by taitgh and taitgl bits).
12. timer page 108 9 2 3 f o 7 0 0 2 , 5 1 . b e f 0 0 . 2 . v e r 0 0 2 0 - 2 0 2 0 b 9 0 j e r ) t 6 2 / c 6 1 m , b 6 2 / c 6 1 m , a 6 2 / c 6 1 m ( p u o r g a 6 2 / c 6 1 m figure 12.2.1. timer b block diagram 12.2 timer b note the tb2 in pin for timer b2 is not available in 42-pin package. [precautions when using timer b2] ? event counter mode the external input signals cannot be counted. set the tck1 bit in the tb2mr register to 1 when using the event count mode. ? pulse period/pulse width measurement mode this mode connot be used. figure 12.2.1 shows a block diagram of the timer b. figures 12.2.2 and 12.2.3 show registers related to the timer b. timer b supports the following four modes. use the tmod1 and tmod0 bits in the tbimr register (i = 0 to 2) to select the desired mode. ? timer mode: the timer counts an internal count source. ? event counter mode: the timer counts pulses from an external device or overflows or underflows of other timers. ? pulse period/pulse width measuring mode: the timer measures an external signal's pulse period or pulse width. ? a/d trigger mode: the timer starts counting by one trigger until the count value becomes 0000 16 . this mode is used together with simultaneous sample sweep mode or delayed trigger mode 0 of a/d converter to start a/d conversion. clock source selection ? event counter reload register low-order 8 bits high-order 8 bits data bus low-order bits data bus high-order bits f 8 tabsr register polarity switching, edge pulse counter reset circuit counter clock selection ? timer mode ? pulse period/, pulse width measuring mode ? a/d trigger mode f 1 or f 2 f c32 f 32 tbj overflow (1) (j = i C 1, except j = 2 if i = 0) can be selected in onlyevent counter mode tbi in (i = 0 to 2) note: 1. overflow or underflow. tbi address tbj timer b0 0391 16 - 0390 16 timer b2 timer b1 0393 16 - 0392 16 timer b0 timer b2 0395 16 - 0394 16 timer b1
12. timer page 109 9 2 3 f o 7 0 0 2 , 5 1 . b e f 0 0 . 2 . v e r 0 0 2 0 - 2 0 2 0 b 9 0 j e r ) t 6 2 / c 6 1 m , b 6 2 / c 6 1 m , a 6 2 / c 6 1 m ( p u o r g a 6 2 / c 6 1 m timer bi mode register (i=0 to 2) symbol address after reset tb0mr to tb2mr 039b 16 to 039d 16 00xx0000 2 bit name function bit symbol rw b7 b6 b5 b4 b3 b2 b1 b0 0 0 : timer mode or a/d trigger mode 0 1 : event counter mode 1 0 : pulse period measurement mode, pulse width measurement mode 1 1 : must not be set b1 b0 tck1 mr3 mr2 mr1 tmod1 mr0 tmod0 tck0 function varies with each operation mode count source select bi t operation mode select bit (1) (2) rw rw rw rw rw rw rw ro function varies with each operation mode figure 12.2.2. tb0mr to tb2mr registers
12. timer page 110 9 2 3 f o 7 0 0 2 , 5 1 . b e f 0 0 . 2 . v e r 0 0 2 0 - 2 0 2 0 b 9 0 j e r ) t 6 2 / c 6 1 m , b 6 2 / c 6 1 m , a 6 2 / c 6 1 m ( p u o r g a 6 2 / c 6 1 m symbol address after reset tabsr 0380 16 00 16 count start flag bit name bit symbol b7 b6 b5 b4 b3 b2 b1 b0 timer b2 count start flag timer b1 count start flag timer b0 count start flag timer a4 count start flag timer a3 count start flag timer a2 count start flag timer a1 count start flag timer a0 count start flag 0 : stops counting 1 : starts counting tb2s tb1s tb0s ta4s ta3s ta2s ta1s ta0s function symbol address after reset tb0 0391 16 , 0390 16 indeterminate tb1 0393 16 , 0392 16 indeterminate tb2 0395 16 , 0394 16 indeterminate b7 b0 b7 b0 (b15) (b8) timer bi register (i=0 to 2)(1) rw measures a pulse period or width functio n rw rw ro rw rw rw rw rw rw rw rw rw divide the count source by n + 1 where n = set value timer mode event counter mode 0000 16 to ffff 16 divide the count source by n + 1 where n = set value (2) 0000 16 to ffff 16 pulse period modulation mode, pulse width modulation mode symbol address after reset cpsrf 0381 16 0xxxxxxx 2 clock prescaler reset flag bit name function bit symbol b7 b6 b5 b4 b3 b2 b1 b0 clock prescaler reset flag cpsr nothing is assigned. when write, set to 0 . when read, their contents are indeterminate. rw rw (b6-b0) setting this bit to 1 initializes the prescaler for the timekeeping clock. (when read, the value of this bit is 0 . ) mode setting range a/d trigger mode (3) divide the count source by n + 1 where n = set value and cause the timer stop rw 0000 16 to ffff 16 notes: 1. the register must be accessed in 16 bit units. 2. the timer counts pulses from an external device or overflows or underflows of other timers. 3. when this mode is used combining delayed trigger mode 0, set the larger value than the value of the timer b0 register to the timer b1 register. figure 12.2.3. tb0 to tb2 registers, tabsr register, cpsrf register
12. timer page 111 9 2 3 f o 7 0 0 2 , 5 1 . b e f 0 0 . 2 . v e r 0 0 2 0 - 2 0 2 0 b 9 0 j e r ) t 6 2 / c 6 1 m , b 6 2 / c 6 1 m , a 6 2 / c 6 1 m ( p u o r g a 6 2 / c 6 1 m item specification count source f 1 , f 2 , f 8 , f 32 , f c32 count operation ? down-count ? when the timer underflows, it reloads the reload register contents and continues counting divide ratio 1/(n+1) n: set value of tbi register (i= 0 to 2) 0000 16 to ffff 16 count start condition set tbis bit (1) to 1 (= start counting) count stop condition set tbis bit to 0 (= stop counting) interrupt request generation timing timer underflow tbi in pin function i/o port read from timer count value can be read by reading tbi register write to timer ? when not counting and until the 1st count source is input after counting start value written to tbi register is written to both reload register and counter ? when counting (after 1st count source input) value written to tbi register is written to only reload register (transferred to counter when reloaded next) note: 1. the tb0s to tb2s bits are assigned to the bit 5 to bit 7 in the tabsr register. 12.2.1 timer mode in timer mode, the timer counts a count source generated internally (see table 12.2.1.1). figure 12.2.1.1 shows tbimr register in timer mode. table 12.2.1.1 specifications in timer mode figure 12.2.1.1 tbimr register in timer mode timer bi mode register (i= 0 to 2) symbol address after reset tb0mr to tb2mr 039b 16 to 039d 16 00xx0000 2 bit name function bit symbol rw b7 b6 b5 b4 b3 b2 b1 b0 operation mode select bit 0 0 : timer mode or a/d trigger mode b1 b0 tmod1 tmod0 mr0 has no effect in timer mode can be set to 0 or 1 mr2 mr1 mr3 0 0 : f 1 or f 2 0 1 : f 8 1 0 : f 32 1 1 : f c32 tck1 tck0 count source select bit 0 0 tb0mr register must be set to 0 in timer mode b7 b6 rw rw rw rw rw rw rw ro tb1mr, tb2mr registers nothing is assigned. when write, set to 0 . when read, its content is indeterminate when write in timer mode, set to 0 . when read in timer mode, its content is indeterminate.
12. timer page 112 9 2 3 f o 7 0 0 2 , 5 1 . b e f 0 0 . 2 . v e r 0 0 2 0 - 2 0 2 0 b 9 0 j e r ) t 6 2 / c 6 1 m , b 6 2 / c 6 1 m , a 6 2 / c 6 1 m ( p u o r g a 6 2 / c 6 1 m item specification count source ? external signals input to tbi in pin (i=0 to 2) (effective edge can be selected in program) ? timer bj overflow or underflow (j=i-1, except j=2 if i=0) count operation ? down-count ? when the timer underflows, it reloads the reload register contents and continues counting divide ratio 1/(n+1) n: set value of tbi register 0000 16 to ffff 16 count start condition set tbis bit (1) to 1 (= start counting) count stop condition set tbis bit to 0 (= stop counting) interrupt request generation timing timer underflow tbi in pin function count source input read from timer count value can be read by reading tbi register write to timer ? when not counting and until the 1st count source is input after counting start value written to tbi register is written to both reload register and counter ? when counting (after 1st count source input) value written to tbi register is written to only reload register (transferred to counter when reloaded next) note: 1. the tb0s to tb2s bits are assigned to the bit 5 to bit 7 in the tabsr register. 12.2.2 event counter mode in event counter mode, the timer counts pulses from an external device or overflows and underflows of other timers (see table 12.2.2.1) . figure 12.2.2.1 shows tbimr register in event counter mode. table 12.2.2.1 specifications in event counter mode figure 12.2.2.1 tbimr register in event counter mode timer bi mode register (i=0 to 2) symbol address after reset tb0mr to tb2mr 039b 16 to 039d 16 00xx0000 2 bit name function bit symbol rw b7 b6 b5 b4 b3 b2 b1 b0 operation mode select bit 0 1 : event counter mode b1 b0 tmod1 tmod0 mr0 count polarity select bit (1) mr2 mr1 mr3 tck1 tck0 01 0 0 : counts external signal's falling edges 0 1 : counts external signal's rising edges 1 0 : counts external signal's falling and rising edges 1 1 : must not be set b3 b2 has no effect in event counter mode. can be set to 0 or 1 . event clock select 0 : input from tbi in pin (2) 1 : tbj overflow or underflow (j = i C 1, except j = 2 if i = 0) rw rw rw rw rw rw rw ro tb0mr register must be set to 0 in timer mode tb1mr, tb2mr registers nothing is assigned. when write, set to 0 . when read, its content is indeterminate. when write in event counter mode, set to 0 . when read in event counter mode, its content is indeterminate. notes: 1. effective when the tck1 bit is set to 0 (input from tbiin pin). if the tck1 bit is set to 1 (tbj overflow or underflow), these bits can be set to 0 or 1 . 2. the port direction bit for the tbiin pin must be set to 0 (= input mode).
12. timer page 113 9 2 3 f o 7 0 0 2 , 5 1 . b e f 0 0 . 2 . v e r 0 0 2 0 - 2 0 2 0 b 9 0 j e r ) t 6 2 / c 6 1 m , b 6 2 / c 6 1 m , a 6 2 / c 6 1 m ( p u o r g a 6 2 / c 6 1 m item specification count source f 1 , f 2 , f 8 , f 32 , f c32 count operation ? up-count ? counter value is transferred to reload register at an effective edge of mea- surement pulse. the counter value is set to 0000 16 to continue counting. count start condition set tbis (i=0 to 2) bit (3) to 1 (= start counting) count stop condition set tbis bit to 0 (= stop counting) interrupt request generation timing ? when an effective edge of measurement pulse is input (1) ? timer overflow. when an overflow occurs, mr3 bit in the tbimr register is set to 1 (overflowed) simultaneously. mr3 bit is cleared to 0 (no over- flow) by writing to tbimr register at the next count timing or later after mr3 bit was set to 1 . at this time, make sure tbis bit is set to 1 (start count- ing). tbi in pin function measurement pulse input read from timer contents of the reload register (measurement result) can be read by reading tbi register (2) write to timer value written to tbi register is written to neither reload register nor counter notes: 1. interrupt request is not generated when the first effective edge is input after the timer started counting. 2. value read from tbi register is indeterminate until the second valid edge is input after the timer starts counting. 3. the tb0s to tb2s bits are assigned to the bit 5 to bit 7 in the tabsr register. 12.2.3 pulse period and pulse width measurement mode in pulse period and pulse width measurement mode, the timer measures pulse period or pulse width of an external signal (see table 12.2.3.1). figure 12.2.3.1 shows tbimr register in pulse period and pulse width measurement mode. figure 12.2.3.2 shows the operation timing when measuring a pulse period. figure 12.2.3.3 shows the operation timing when measuring a pulse width. table 12.2.3.1 specifications in pulse period and pulse width measurement mode figure 12.2.3.1 tbimr register in pulse period and pulse width measurement mode timer bi mode register (i=0 to 2) symbol address after reset tb0mr to tb2mr 039b 16 to 039d 16 00xx0000 2 bit name bit symbol rw b7 b6 b5 b4 b3 b2 b1 b0 operation mode select bit 1 0 : pulse period / pulse width measurement mode b1 b0 tmod1 tmod0 mr0 measurement mode select bit mr2 mr1 mr3 tck1 tck0 0 1 0 0 : pulse period measurement (measurement between a falling edge and the next falling edge of measured pulse) 0 1 : pulse period measurement (measurement between a rising edge and the next rising edge of measured pulse) 1 0 : pulse width measurement (measurement between a falling edge and the next rising edge of measured pulse and between a rising edge and the next falling edge) 1 1 : must not be set. functio n b3 b2 count source select bi t timer bi overflow flag (1) 0 : timer did not overflow 1 : timer has overflowed 0 0 : f 1 or f 2 0 1 : f 8 1 0 : f 32 1 1 : f c32 b7 b6 rw rw rw rw rw rw rw ro tb0mr register must be set to 0 in pulse period and pulse width measurement mode tb1mr, tb2mr registers nothing is assigned. when write, set to 0 . when read, its content turns out to be indeterminate. note: 1. this flag is indeterminate after reset. when the tbis bit is set to "1" (start counting), the mr3 bit is cleared to 0 (no overflow) by writing to the tbimr register at the next count timing or later after the mr3 bit was set to 1 (overflowed). the mr3 bit cannot be set to 1 in a program. the tb0s to tb2s bits are assigned to the bit 5 to bit 7 in the tabsr register.
12. timer page 114 9 2 3 f o 7 0 0 2 , 5 1 . b e f 0 0 . 2 . v e r 0 0 2 0 - 2 0 2 0 b 9 0 j e r ) t 6 2 / c 6 1 m , b 6 2 / c 6 1 m , a 6 2 / c 6 1 m ( p u o r g a 6 2 / c 6 1 m figure 12.2.3.3 operation timing when measuring a pulse width measurement pulse h count source timing at which counter reaches 0000 16 1 1 transfer (measured value) transfer (measured value) l 0 0 1 0 (1) (1) (1) transfer (measured value) (1) (2) transfer (indeterminate value) reload register counter transfer timing tbis bit ir bit in the tbiic register mr3 bit in the tbimr register the tb0s to tb2s bits are assigned to the bit 5 to bit 7 in the tabsr register. set to 0 upon accepting an interrupt request or by writing in program i = 0 to 2 notes: 1. counter is initialized at completion of measurement. 2. timer has overflowed. 3. this timing diagram is for the case where the mr1 to mr0 bits in the tbimr register are 10 2 (measure the interval from a falling edge to the next rising edge and the interval from a rising edge to the next falling edge of the measurement pulse). figure 12.2.3.2 operation timing when measuring a pulse period count source measurement pulse tbis bit ir bit in the tbiic register timing at which counter reaches 0000 16 h 1 transfer (indeterminate value) l 0 0 mr3 bit in thetbimr register 1 0 (1) (1) (2) transfer (measured value) 1 reload register counter transfer timing the tb0s to tb2s bits are assigned to the bit 5 to bit 7 in the tabsr register. set to 0 upon accepting an interrupt request or by writing in program i = 0 to 2 notes: 1. counter is initialized at completion of measurement. 2. timer has overflowed. 3. this timing diagram is for the case where the mr1 to mr0 bits in the tbimr register are 00 2 (measure the interval from falling edge to falling edge of the measurement pulse).
12. timer page 115 9 2 3 f o 7 0 0 2 , 5 1 . b e f 0 0 . 2 . v e r 0 0 2 0 - 2 0 2 0 b 9 0 j e r ) t 6 2 / c 6 1 m , b 6 2 / c 6 1 m , a 6 2 / c 6 1 m ( p u o r g a 6 2 / c 6 1 m 12.2.4 a/d trigger mode a/d trigger mode is used as conversion start trigger for a/d converter in simultaneous sample sweep mode of a/d conversion or delayed trigger mode 0. this mode is used as conversion start trigger of a/d converter. a/d trigger mode is used in timer b0 and timer b1. in this mode, the timer starts counting by one trigger until the count value becomes 0000 16 . figure 12.2.4.1 shows the tbimr register in a/d trigger mode and figure 12.2.4.2 shows the tb2sc register. item specification count source f 1 , f 2 , f 8 , f 32 , and f c32 count operation ? down count ? when the timer underflows, reload register contents are reloaded before stopping counting ? when a trigger is generated during the count operation, the count is not affected divide ratio 1/(n+1) n: setting value of tbi register (i=0,1) 0000 16 -ffff 16 count start condition when the tbis (i=0,1) bit in the tabsr register is "1"(count started), tbien (i=0,1) bit in tb2sc register is "1", and the following trigger is generated. (selection based on tb2sel bit in the tb2sc register) ? timer b2 overflow or underflow ? underflow of timer b2 interrupt generation frequency counter setting count stop condition ? after the count value is 0000 16 and reload register contents are reloaded ? set the tbis bit to "0"(count stopped) i nterrupt request timer underflows (1) generation timing tbiin pin function i/o port read from timer count value can be read by reading tbi register write to timer (2) ? when writing in the tbi register during count stopped. value is written to both reload register and counter ? when writing in the tbi register during count. value is written to only reload register (transfered to counter when reloaded next) notes: 1. a/d conversion is started by the timer underflow. for details refer to section 14. a/d converter . 2. when using in delayed trigger mode 0, set the larger value than the value of the timer b0 register to the timer b1 register. table 12.2.4.1 a/d trigger mode specifications
12. timer page 116 9 2 3 f o 7 0 0 2 , 5 1 . b e f 0 0 . 2 . v e r 0 0 2 0 - 2 0 2 0 b 9 0 j e r ) t 6 2 / c 6 1 m , b 6 2 / c 6 1 m , a 6 2 / c 6 1 m ( p u o r g a 6 2 / c 6 1 m timer bi mode register (i= 0 to 1) symbol address after reset tb0mr to tb1mr 039b 16 to 039c 16 00xx0000 2 bit name function bit symbol rw b7 b6 b5 b4 b3 b2 b1 b0 operation mode select bit 0 0 : timer mode or a/d trigger mode b1 b0 tmod1 tmod0 mr0 invalid in a/d trigger mode either "0" or "1" is enabled mr2 mr1 mr3 0 0 : f 1 or f 2 0 1 : f 8 1 0 : f 32 1 1 : f c32 tck1 tck0 count source select bit (1) 0 0 tb0mr register set to 0 in a/d trigger mode b7 b6 rw rw rw rw rw rw rw ro tb1mr register nothing is assigned. when write, set to 0 . when read, its content is indeterminate when write in a/d trigger mode, set to 0 . when read in a/d trigger mode, its content is indeterminate. note: 1. when this bit is used in dela y ed tri gg er mode 0, set the same count source to the timer b0 and timer b1. figure 12.2.4.1 tbimr register in a/d trigger mode pwcom symbol address after reset tb2sc 039e 16 x0000000 2 timer b2 reload timing switch bit 0 : timer b2 underflow 1 : timer a output at odd-numbered timer b2 special mode register (1) bit name function bit symbol b7 b6 b5 b4 b3 b2 b1 b0 ivpcr1 three-phase output port sd control bit 1 0 : three-phase output forcible cutoff by sd pin input (high impedance) disabled 1 : three-phase output forcible cutoff by sd pin input (high impedance) enabled rw rw rw nothing is assigned. when write, set to 0 . when read, its content is 0 . (b7) tb2sel trigger select bit 0 : tb2 interrupt 1 : underflow of tb2 interrupt generation frequency setting counter [ictb2] rw rw tb0en timer b0 operation mode select bit 0 : other than a/d trigger mode 1 : a/d trigger mode (5) rw tb1en timer b1 operation mode select bit 0 : other than a/d trigger mode 1 : a/d trigger mode (5) rw (2) (3, 4, 7) (6) (b6-b5) reserved bits must set to "0" 0 0 notes: 1. write to this register after setting the prc1 bit in the prcr register to "1" (write enabled). 2. if the inv11 bit is "0" (three-phase mode 0) or the inv06 bit is "1" (triangular wave modulation mode), set this bit to "0" (timer b2 underflow). 3. when setting the ivpcr1 bit to "1" (three-phase output forcible cutoff by sd pin input enabled), set the pd8_5 bit to "0" (= input mode). 4. related pins are u(p8 0 ), u(p8 1 ), v(p7 2 ), v(p7 3 ), w(p7 4 ), w(p7 5 ). when a high-level ("h") signal is applied to the sd pin and set the ivpcr1 bit to 0 after forcible cutoff, pins u, u, v, v, w, and w are exit from the high-impedance state. if a low-level ( l ) signal is applied to the sd pin, three-phase motor control timer output will be disabled (inv03=0). at this time, when the ivpcr1 bit is 0, pins u, u, v, v, w, and w become programmable i/o ports. when the ivpcr1 bit is set to 1, pins u, u, v, v, w, and w are placed in a high-impedance state regardless of which function of those pins is used. 5. when this bit is used in delayed trigger mode 0, set the tb0en and tb1en bits to "1"(a/d trigger mode). 6. when setting the tb2sel bit to "1" (underflow of tb2 interrupt generation frequency setting counter[ictb2]), set the inv02 bit to "1" (three-phase motor control timer function). 7. refer to 16.6 di g ital debounce function for sd in p ut. figure 12.2.4.2 tb2sc register
12. timer page 117 9 2 3 f o 7 0 0 2 , 5 1 . b e f 0 0 . 2 . v e r 0 0 2 0 - 2 0 2 0 b 9 0 j e r ) t 6 2 / c 6 1 m , b 6 2 / c 6 1 m , a 6 2 / c 6 1 m ( p u o r g a 6 2 / c 6 1 m item specification three-phase waveform output pin ___ ___ ___ six pins (u, u, v, v, w, w) forced cutoff input (1) _____ input l to sd pin used timers timer a4, a1, a2 (used in the one-shot timer mode) ___ timer a4: u- and u-phase waveform control ___ timer a1: v- and v-phase waveform control ___ timer a2: w- and w-phase waveform control timer b2 (used in the timer mode) carrier wave cycle control dead timer timer (3 eight-bit timer and shared reload register) dead time control output waveform triangular wave modulation, sawtooth wave modification enable to output h or l for one cycle enable to set positive-phase level and negative-phase level respectively carrier wave cycle triangular wave modulation: count source x (m+1) x 2 sawtooth wave modulation: count source x (m+1) m: setting value of tb2 register, 0 to 65535 count source: f 1 , f 2 , f 8 , f 32 , f c32 three-phase pwm output width triangular wave modulation: count source x n x 2 sawtooth wave modulation: count source x n n: setting value of ta4, ta1 and ta2 register (of ta4, ta41, ta1, ta11, ta2 and ta21 registers when setting the inv11 bit to 1 ), 1 to 65535 count source: f 1 , f 2 , f 8 , f 32 , f c32 dead time active disable function count source x p, or no dead time p: setting value of dtt register, 1 to 255 count source: f 1 , f 2 , f 1 divided by 2, f 2 divided by 2 active level eable to select h or l positive and negative-phase concurrent positive and negative-phases concurrent active disable function positive and negative-phases concurrent active detect function interrupt frequency for timer b2 interrupt, select a carrier wave cycle-to-cycle basis through 15 times carrier wave cycle-to-cycle basis 12.3 three-phase motor control timer function timers a1, a2, a4 and b2 can be used to output three-phase motor drive waveforms. table 12.3.1 lists the specifications of the three-phase motor control timer function. figure 12.3.1 shows the block diagram for three-phase motor control timer function. also, the related registers are shown on figure 12.3.2 to figure 12.3.8. table 12.3.1. three-phase motor control timer function specifications notes: _____ 1. when the inv02 bit in the invc0 register is set to 1 (three-phase motor control timer function), the sd _____ function of the p8 5 /sd pin is enabled. at this time, the p8 5 pin cannot be used as a programmable i/o _____ _____ port. when the sd function is not used, apply h to the p8 5 /sd pin. _____ 2. when the ivpcr1 bit in the tb2sc register is set to 1 (enable three-phase output forced cutoff by sd _____ pin input), and l is applied to the sd pin, the related pins enter high-impedance state regardless of the functions which are used. when the ivpcr1 bit is set to 0 (disabled three-phase output forced cutoff _____ _____ by sd pin input) and l is applied to the sd pin, the related pins can be selected as a programmable i/ o port and the setting of the port and port direction registers are enable. related pins p7 2 /clk 2 /ta1 out /v/rxd 1 _________ _________ ___ p7 3 /cts 2 /rts 2 /ta1 in /v/txd 1 p7 4 /ta2 out /w ____ p7 5 /ta2 in /w p8 0 /ta4 out /u ___ p8 1 /ta4 in /u
12. timer page 118 9 2 3 f o 7 0 0 2 , 5 1 . b e f 0 0 . 2 . v e r 0 0 2 0 - 2 0 2 0 b 9 0 j e r ) t 6 2 / c 6 1 m , b 6 2 / c 6 1 m , a 6 2 / c 6 1 m ( p u o r g a 6 2 / c 6 1 m d r q 0 inv12 1 t ri g ge r t ri g ge r ti mer b2 (t i mer mo d e ) s ignal to b e written to timer b2 1 ti mer b2 interrupt reque st bit du1 b it d t q q q u three-phase outpu t shif t register (u phase) dead tim e tim er n = 1 to 255 t ri gg er t ri gge r reload regi ster n = 1 to 255 t ri gg er tri gg er u phase outpu t signal u v v v w w w phase ou tput control circuit d q t d q t w d q t d q t v d q t d q t u w v u reload ti mer a 1 counter (on e-sho t ti mer mode) t ri g ge r t q reload ti mer a2 counter (on e-sho t ti me r mo de) t ri g ge r t q re load ti mer a4 counter (on e-sho t ti me r mo de) t ri g ger t q t r a nsfe r trig g er ( n ot e 1 ) t ime r b2 u nde rflow d u0 bit d ub0 bit ta4 register ta41 register ta1 register ta11 register ta2 register ta21 register timer ai(i = 1, 2, 4) start trigger signal timer a4 reload control signal timer a4 one-shot pulse dub1 bit dead time timer n = 1 to 2 55 dead time timer n = 1 to 255 interrupt occurrence set circuit ictb2 register n = 1 to 15 0 inv13 ictb2 counter n = 1 to 15 sd reset inv03 inv14 inv05 inv04 inv00 inv01 inv11 inv11 inv11 inv11 inv06 inv06 inv06 inv07 inv10 1/2 f1 or f2 phase ou tput contro l circuit p hase output control circuit ph ase output signal ph ase output signal phase outpu t signal ph ase output signal ph ase output signal rever se control rever se control r ever se control reverse control rever se control d t d t q d t reverse cont rol idw idv idu d q t d q t d q t b2 b0 b1 bits 2 through 0 of position-data- retain function control regi ster (address 034e 16 ) pd8_0 pd8_1 pd7_2 pd7_3 pd7_4 pd7_5 s q r reset sd ivprc1 data bus note: 1. if the inv06 bit is set to "0" (triangular wave modulation mode), a transfer trigger is generated at only the first occ urrence of a timer b2 underflow after writing to the idb0 and idb1 registers. set to "0" when the ta2s bit is set to "0" set to "0" when ta1s bit = "0" set to "0" when ta4s bit = "0" diagram for switching to p8 0 , p81 and p7 2 - p7 5 is not shown. figure 12.3.1. three-phase motor control timer functions block diagram
12. timer page 119 9 2 3 f o 7 0 0 2 , 5 1 . b e f 0 0 . 2 . v e r 0 0 2 0 - 2 0 2 0 b 9 0 j e r ) t 6 2 / c 6 1 m , b 6 2 / c 6 1 m , a 6 2 / c 6 1 m ( p u o r g a 6 2 / c 6 1 m figure 12.3.2. invc0 register three-phase pwm control register 0 (1) symbol address after reset invc0 0348 16 00 16 b7 b6 b5 b4 b3 b2 b1 b0 effective interrupt output polarity select bit inv00 bit symbol bit name description rw inv01 effective interrupt output specification bit inv02 mode select bit inv04 positive and negative phases concurrent output disable bit inv07 software trigger select bit inv06 modulation mode select bit inv05 positive and negative phases concurrent output detect flag inv03 output control bit 0: the ictb2 counter is incremented by one on the rising edge of the timer a1 reload control signal 1: the ictb2 counter is incremented by one on the falling edge of the timer a1 reload control signal 0: ictb2 counter incremented by 1 at a timer b2 underflow 1: selected by inv00 bit 0: three-phase motor control timer function unused 1: three-phase motor control timer function 0: three-phase motor control timer output disabled 1: three-phase motor control timer output enabled 0: simultaneous active output enabled 1: simultaneous active output disabled 0: not detected yet 1: already detected 0: triangular wave modulation mode 1: sawtooth wave modulation mode setting this bit to 1 generates a transfer trigger. if the inv06 bit is 1 , a trigger for the dead time timer is also generated. the value of this bit when read is 0 . (9) (3) (7) (2, 3) n (4) rw rw rw rw rw rw rw rw (5) (8) item mode timing at which transferred from idb0 to idb1 registers to three-phase output shift register timing at which dead time timer trigger is generated when inv16 bit is 0 inv13 bit inv06=0 triangular wave modulation mode transferred only once synchronously with the transfer trigger after writing to the idb0 to idb1 registers synchronous with the falling edge of timer a1, a2, or a4 one-shot pulse effective when inv11 is 1 and inv06 is 0 inv06=1 sawtooth wave modulation mode transferred every transfer trigger synchronous with the transfer trigger and the falling edge of timer a1, a2, or a4 one-shot pulse transfer trigger: timer b2 underflow, write to the inv07 bit or write to the tb2 register when inv10 is 1 (6) has no effect (10) (5) notes: 1. write to this register after setting the prc1 bit in the prcr register to 1 (write enable). note also that inv00 to inv02, inv04 and inv06 bits can only be rewritten when timers a1, a2, a4 and b2 are idle. 2. if this bit needs to be set to 1 , set any value in the ictb2 register before writing to it. 3. effective when the inv11 bit is set to 1 (three-phase mode 1). if inv11 is set to 0 (three-phase mode 0), the ictb2 counter is incremented by 1 each time the timer b2 underflows, regardless of whether the inv00 and inv01 bits are set. when setting the inv01 bit to 1 , set the timer a1 count start flag before the first timer b2 underflow.when the inv00 bit is set to 1 , the first interrupt is generated when the timer b2 underflows n-1 times, if n is the value set in the ictb2 counter. subsequent interrupts are generated every n times the timer b2 underflow. 4. setting the inv02 bit to 1 activates the dead time timer, u/v/w-phase output control circuits and ictb2 counter. 5. when the inv02 bit is set to 1 (theee-phase control timer functions) and the inv03 is set to "0"(three-phase motor control timer output disabled), u, u, v, v, w and w pins, including pins shared with other output functions, enter a high-impedance state. 6. the inv03 bit is set to 0 in the following cases: when reset when positive and negative go active (inv05="1") simultaneously while inv04 bit is set to 1 when set to 0 in a program when input on the sd pin changes state from h to l (the inv03 bit cannot be set to 1 when sd input is l .) when both the inv04 and the inv05 bits are set to 1 , the inv03 bit is set to 0 . 7. can only be set by writing 0 in a program, and cannot be set to 1 . 8. the effects of the inv06 bit are described in the table below. 9. if the inv06 bit is 1 , set the inv11 bit to 0 (three-phase mode 0) and set the pwcon bit to 0 (timer b2 reloaded by a timer b2 underflow). 10. individual pins can be disabled using pfcr register.
12. timer page 120 9 2 3 f o 7 0 0 2 , 5 1 . b e f 0 0 . 2 . v e r 0 0 2 0 - 2 0 2 0 b 9 0 j e r ) t 6 2 / c 6 1 m , b 6 2 / c 6 1 m , a 6 2 / c 6 1 m ( p u o r g a 6 2 / c 6 1 m figure 12.3.3. invc1 register three-phase pwm control register 1 (1) symbol address after reset invc1 0349 16 00 16 b7 b6 b5 b4 b3 b2 b1 b0 timer a1, a2, a4 start trigger signal select bit inv10 bit symbol bit name description rw inv11 timer a1-1, a2-1, a4-1 control bit inv12 dead time timer count source select bit inv14 output polarity control bit (b7) reserved bit inv16 dead time timer trigger select bit inv15 dead time invalid bit inv13 carrier wave detect flag 0: timer b2 underflow 1: timer b2 underflow and write to the tb2 register 0: three-phase mode 0 1: three-phase mode 1 0 : f 1 or f 2 1 : f 1 divided by 2 or f 2 divided by 2 0: timer a1 reload control signal is 0 1: timer a1 reload control signal is 1 0 : output waveform l active 1 : output waveform h active 0: dead time timer enabled 1: dead time timer disabled 0: falling edge of timer a4, a1 or a2 one-shot pulse 1: rising edge of three-phase output shift register (u, v or w phase) output this bit should be set to 0 (6) (5) rw rw rw rw rw rw rw ro (3) item mode ta11, ta21, ta41 registers inv00 bit, inv01 bit inv13 bit inv11=0 three-phase mode 1 three-phase mode 0 not used has no effect. ictb2 counted every time timer b2 underflows regardless of whether the inv00 to inv01 bits are set. has no effect inv11=1 used effect effective when inv11 bit is set to 1 and inv06 bit is set to 0 (4) 0 (2) 4. if the inv06 bit is set to 1 (sawtooth wave modulation mode), set this bit to 0 (three-phase mode 0). also, if the inv11 bit is 0 , set the pwcon bit to 0 (timer b2 reloaded by a timer b2 underflow). 5. the inv13 bit is effective only when the inv06 bit is set to 0 (triangular wave modulation mode) and the inv11 bit is set to 1 (three-phase mode 1). 6. if all of the following conditions hold true, set the inv16 bit to 1 (dead time timer triggered by the rising edge of three-phase output shift register output) ? the inv15 bit is set to 0 (dead time timer enabled) ? when the inv03 bit is set to 1 (three-phase motor control timer output enabled), the dij bit and dibj bit (i:u, v, or w, j: 0 to 1) have always different values (the positive-phase and negative-phase always output different levels during the period other than dead time). conversely, if either one of the above conditions holds false, set the inv16 bit to 0 (dead time timer triggered by the falling edge of one-shot pulse). notes: 1. write to this register after setting the prc1 bit in the prcr register to 1 (write enable). note also that this register can only be rewritten when timers a1, a2, a4 and b2 are idle. 2. a start trigger is generated by writing to the tb2 register only while timer b2 stops. 3. the effects of the inv11 bit are described in the table below.
12. timer page 121 9 2 3 f o 7 0 0 2 , 5 1 . b e f 0 0 . 2 . v e r 0 0 2 0 - 2 0 2 0 b 9 0 j e r ) t 6 2 / c 6 1 m , b 6 2 / c 6 1 m , a 6 2 / c 6 1 m ( p u o r g a 6 2 / c 6 1 m three-phase output bu ff er re g ister(i=0,1) (1) symbol address when reset idb0 034a 16 00111111 2 idb1 034b 16 00111111 2 rw rw rw rw bit name function bit symbol dui dubi dvi u phase output buffer i note: 1. the idb0 and idb1 register values are transferred to the three-phase shift register by a transfer trigger. the value written to the idb0 register aftera transfer trigger represents the output signal of each phase, and the next value written to the idb1 register at the falling edge of the timer a1, a2 or a4 one-shot pulse represents the output signal of each phase. (b7-b6) rw dvbi nothing is assigned. when write, set to "0". when read, these contents are "0". write the output level 0: active level 1: inactive level when read, these bits show the three-phase output shift register value. dwi dwbi rw rw u phase output buffer i v phase output buffer i v phase output buffer i w phase output buffer i w phase output buffer i b 7 b5 b 4 b3 b 2b1b0 dead time timer (1, 2) symbol address when reset dtt 034c 16 indeterminate wo rw function setting range notes: 1. use mov instruction to write to this register. 2. effective when the inv15 bit is set to ? (dead time timer enable). if the inv15 bit is set to 1 , the dead time timer is disabled and has no e ff ect. 1 to 255 b7 b6 b5 b4 b3 b2 b1 b0 assuming the set value = n, upon a start trigger the timer starts counting the count souce selected by the inv12 bit and stops after counting it n times. the positive or negative phase whichever is going from an inactive to an active level changes at the same time the dead time timer stops. ro figure 12.3.4. idb0 register, idb1register, dtt register, and ictb2 register timer b2 interrupt occurrences frequency set counter symbol ictb2 address 034d 16 after reset indeterminate function setting range b7 b6 b5 b4 b0 if the inv01 bit is "0" (ictb2 counter counted every time timer b2 underflows), assuming the set value = n, a timer b2 interrupt is generated at every n ? th occurrence of a timer b2 underflow. if the inv01 bit is "1" (ictb2 counter count timing selected by the inv00 bit), assuming the set value = n, a timer b2 interrupt is generated at every n ? th occurrence of a timer b2 underflow that meets the condition selected by the inv00 bit. 1 to 15 note: 1. use mov instruction to write to this register. if the inv01 bit is set to "1", make sure the tb2s bit also is set to "0" (timer b2 count stopped) when writing to this register. if the inv01 bit is set to "0", although this register can be written even when the tb2s bit is set to "1" (timer b2 count start), do not write synchronously with a timer b2 underflow. rw wo (1) nothing is assigned. when write, set to "0". when read, its content is indeterminate. b3
12. timer page 122 9 2 3 f o 7 0 0 2 , 5 1 . b e f 0 0 . 2 . v e r 0 0 2 0 - 2 0 2 0 b 9 0 j e r ) t 6 2 / c 6 1 m , b 6 2 / c 6 1 m , a 6 2 / c 6 1 m ( p u o r g a 6 2 / c 6 1 m figure 12.3.5. ta1, ta2, ta4, ta11, ta21 and ta41 registers symbol address after reset ta1 0389 16 -0388 16 ta2 038b 16 -038a 16 indeterminate ta4 038f 16 -038e 16 indeterminate ta11 (6,7) 0343 16 -0342 16 indeterminate ta21 (6,7) 0345 16 -0344 16 indeterminate ta41 (6,7) 0347 16 -0346 16 indeterminate b7 b0 b7 b0 (b15) ( b8) rw assuming the set value = n, upon a start trigger the timer starts counting the count source and stops after counting it n times. the positive and negative phases change at the same time timer a, a2 or a4 stops. function setting range timer ai, ai-1 register (i=1, 2, 4) (1, 2, 3, 4, 5) wo 0000 16 to ffff 16 indeterminate notes: 1. the register must be accessed in 16 bit units. 2. when the timer ai register is set to "0000 16 ", the counter does not operate and a timer ai interrupt does not occur. 3.use mov instruction to write to these registers. 4. if the inv15 bit is "0" (dead time timer enable), the positive or negative phase whichever is going from an inactive to an active level changes at the same time the dead time timer stops. 5. if the inv11 bit is "0" (three-phase mode 0), the tai register value is transferred to the reload register by a timer ai (i = 1, 2 or 4) start trigger. if the inv11 bit is "1" (three-phase mode 1), the tai1 register value is transferred to the reload register by a timer ai start trigger first and then the tai register value is transferred to the reload register by the next timer ai start trigger. thereafter, the tai1 register and tai register values are transferred to the reload register alternately. 6. do not write to tai1 registers synchronously with a timer b2 underflow in three-phase mode 1. 7. write to the tai1 register as follows: (1) write a value to the tai1 register (2) wait for one cycle of timer ai count source. (3) write the same value to the tai1 register again.
12. timer page 123 9 2 3 f o 7 0 0 2 , 5 1 . b e f 0 0 . 2 . v e r 0 0 2 0 - 2 0 2 0 b 9 0 j e r ) t 6 2 / c 6 1 m , b 6 2 / c 6 1 m , a 6 2 / c 6 1 m ( p u o r g a 6 2 / c 6 1 m figure 12.3.6. tb2sc registers 0: three-phase output forcible cutoff by sd pin input (high impedance) disabled 1: three-phase output forcible cutoff by sd pin input (high impedance) enabled notes: 1. when "l" is applied to the sd pin, inv03 bit is changed to 0 at the same time. 2. the value of the port register and the port direction register becomes effective. 3. when sd function is not used, set to 0 (input) in pd8 5 and pullup to "h" in sd pin from outside. 4. to leave the high-impedance state and restart the three-phase pwm signal output after the three-phase pwm signal output forced cutoff, set the ivpcr1 bit to 0 after the sd pin input level becomes high ( h ). ivpcr1 bit status of u/v/w pins remarks sd pin inputs 1 (three-phase output forcrible cutoff enable) 0 (three-phase output forcrible cutoff disable) h l h l high impedance peripheral input/output or input/output port peripheral input/output or input/output port peripheral input/output or input/output port three-phase output forcrible cutoff (1) ivpcr1 bit status of u/v/w pins remarks sd pin inputs (3) 1 (three-phase output forcrible cutoff enable) 0 (three-phase output forcrible cutoff disable) h l (1) h l (1) high impedance (4) three-phase output forcrible cutoff input/output port (2) three-phase pwm output three-phase pwm output the effect of sd pin input is below. 1.case of inv03 = 1(three-phase motor control timer output enabled) pwcon symbol address after reset tb2sc 039e 16 x0000000 2 timer b2 reload timing switch bit timer b2 special mode register (1) bit name function bit symbol b7 b6 b5 b4 b3 b2 b1 b0 ivpcr1 three-phase output port sd control bit 1 rw rw rw nothing is assigned. if necessary, set to 0. when read, the content is 0. (b7) tb2sel trigger select bit 0: tb2 interrupt 1: underflow of tb2 interrupt generation frequency setting counter [ictb2] rw rw tb0en timer b0 operation mode select bit 0: other than a/d trigger mode 1: a/d trigger mode rw tb1en timer b1 operation mode select bit 0: other than a/d trigger mode 1: a/d trigger mode rw (2) (3, 4, 7) (5) (5) (6) (b6-b5) reserved bits set to 0 0 0 notes: 1. write to this register after setting the prc1 bit in the prcr register to 1 (write enabled). 2. if the inv11 bit is 0 (three-phase mode 0) or the inv06 bit is 1 (triangular wave modulation mode), set this bit to 0 (time r b2 underflow). 3. when setting the ivpcr1 bit to 1 (three-phase output forcible cutoff by sd pin input enabled), set the pd8 5 bit to 0 (= input mode). 4. related pins are u(p8 0 ), u(p8 1 ), v(p7 2 ), v(p7 3 ), w(p7 4 ), w(p7 5 ). when a high-level ("h") signal is applied to the sd pin and set the ivpcr1 bit to 0 after forcible cutoff, pins u, u, v, v, w, and w are exit from the high-impedance state. if a low- level ( l ) signal is applied to the sd pin, three-phase motor control timer output will be disabled (inv03=0). at this time, when the ivpcr1 bit is 0, pins u, u, v, v, w, and w become programmable i/o ports. when the ivpcr1 bit is set to 1, pins u, u, v, v, w, and w are placed in a high-impedance state regardless of which function of those pins is used. 5. when this bit is used in delayed trigger mode 0, set bits tb0en and tb1en to 1 (a/d trigger mode). 6. when setting the tb2sel bit to 1 (underflow of tb2 interrupt generation frequency setting counter[ictb2]), set the inv02 bit to 1 (three-phase motor control timer function). note: 1. the three-phase output forcrible cutoff function becomes effective if the inpcr1 bit is set to 1 (three-phase output forcrible cutoff function enable) even when the inv03 bit is 0 (three-phase motor control timer output disalbe) 2.case of inv03 = 0(three-phase motor control timer output disabled) 0: timer b2 underflow 1: timer a output at odd-numbered
12. timer page 124 9 2 3 f o 7 0 0 2 , 5 1 . b e f 0 0 . 2 . v e r 0 0 2 0 - 2 0 2 0 b 9 0 j e r ) t 6 2 / c 6 1 m , b 6 2 / c 6 1 m , a 6 2 / c 6 1 m ( p u o r g a 6 2 / c 6 1 m figure 12.3.7. tb2 register, trgsr register, and tabsr register ta1tgl symbol address after reset trgsr 0383 16 00 16 timer a1 event/trigger select bit to use the v-phase output control circuit, set these bits to 01 2 (tb2 underflow). trigger select register bit name function bit symbol b0 to use the w-phase output control circuit, set these bits to 01 2 (tb2 underflow). 0 0 : input on ta3 in is selected (1) 0 1 : tb2 overflow is selected (2) 1 0 : ta2 overflow is selected (2) 1 1 : ta4 overflow is selected (2) to use the u-phase output control circuit, set these bits to 01 2 (tb2 underflow). timer a2 event/trigger select bit timer a3 event/trigger select bit timer a4 event/trigger select bit rw ta1tgh ta2tgl ta2tgh ta3tgl ta3tgh ta4tgl ta4tgh b5 b4 b7 b6 b5 b4 b3 b2 b1 symbol address after reset tabsr 0380 16 00 16 count start fla g bit name function bit symbol b7 b6 b5 b4 b3 b2 b1 b0 timer b2 count start flag timer b1 count start flag timer b0 count start flag timer a4 count start flag timer a3 count start flag timer a2 count start flag timer a1 count start flag timer a0 count start flag 0 : stops counting 1 : starts counting tb2s tb1s tb0s ta4s ta3s ta2s ta1s ta0s rw rw rw rw rw rw rw rw rw rw rw rw rw rw rw rw rw notes: 1. set the corresponding port direction bit to 0 (input mode). 2. overflow or underflow symbol address after reset tb2 0395 16 to 0394 16 indeterminate b7 b0 b7 b0 (b15) ( b8) rw 0000 16 to ffff 16 function setting rang e timer b2 register (1) note: 1. the register must be accessed in 16 bit units. rw divide the count source by n + 1 where n = set value. timer a1, a2 and a4 are started at every occurrence of underflow.
12. timer page 125 9 2 3 f o 7 0 0 2 , 5 1 . b e f 0 0 . 2 . v e r 0 0 2 0 - 2 0 2 0 b 9 0 j e r ) t 6 2 / c 6 1 m , b 6 2 / c 6 1 m , a 6 2 / c 6 1 m ( p u o r g a 6 2 / c 6 1 m figure 12.3.8. ta1mr, ta2mr, ta4mr, and tb2mr registers bit name timer ai mode register symbol address after reset ta1mr 0397 16 00 16 ta2mr 0398 16 00 16 ta4mr 039a 16 00 16 function bit symbol b7 b6 b5 b4 b3 b2 b1 b0 operation mode select bit must set to 10 2 (one-shot timer mode) for the three-phase motor control timer function tmod1 tmod0 mr0 pulse output function select bit must set to 0 for the three-phase motor control timer function mr2 mr1 mr3 must set to 0 for the three-phase motor control timer function 0 0 : f 1 or f 2 0 1 : f 8 1 0 : f 32 1 1 : f c32 b7 b6 tck1 tck0 count source select bit 10 0 must set to 1 (selected by event/trigger select register) for the three-phase motor control timer function trigger select bit external trigger select bit rw timer b2 mode register symbol address after reset tb2mr 039d 16 00xx0000 2 bit name function bit symbol rw b7 b6 b5 b4 b3 b2 b1 b0 operation mode select bit set to 00 2 (timer mode) for the three- phase motor control timer function tmod1 tmod0 mr0 mr2 mr1 mr3 0 0 : f 1 or f 2 0 1 : f 8 1 0 : f 32 1 1 : f c32 tck1 tck0 count source select bit 0 when write in three-phase motor control timer function, write 0 . when read, its content is indeterminate. 0 b7 b6 1 0 has no effect for the three-phase motor control timer function rw rw rw rw rw rw rw rw rw rw rw rw rw rw ro has no effect for the three-phase motor control timer function. when write, set to 0 . when read, its content is indeterminate. must set to 0 for the three-phase motor control timer function 0
12. timer page 126 9 2 3 f o 7 0 0 2 , 5 1 . b e f 0 0 . 2 . v e r 0 0 2 0 - 2 0 2 0 b 9 0 j e r ) t 6 2 / c 6 1 m , b 6 2 / c 6 1 m , a 6 2 / c 6 1 m ( p u o r g a 6 2 / c 6 1 m figure 12.3.9. triangular wave modulation operation the three-phase motor control timer function is enabled by setting the inv02 bit in the vc0 register to 1 . when this function is on, timer b2 is used to control the carrier wave, and timers a4, a1 and a2 are used to __ ___ ___ control three-phase pwm outputs (u, u, v, v, w and w). the dead time is controlled by a dedicated dead- time timer. figure 12.3.9 shows the example of triangular modulation waveform, and figure 12.3.10 shows the example of sawtooth modulation waveform. start trigger signal for timer a4 (1) timer b2 u phase triangular wave signal wave u phase output signal (1) m nn p p m u phase u phase u phase inv14 = 0 triangular waveform as a carrier wave timer a4 one-shot pulse (1) inv14 = 1 dead time dead time rewrite registers idb0 and idb1 note: 1. internal signals. see figure 12.3.1 . examples of pwm output change are: (1)when inv11 = 1 (three-phase mode 1) inv01 = 0 and ictb2 = 2 16 (the timer b2 interrupt is generated every two times the timer b2 underflows), or inv01 = 1, inv00 = 1, and ictb2=1 16 (the timer b2 interrupt is generated at the falling edge of the timer a1 reload control signal.) default value of the timer: ta41 = m, ta4 = m. registers ta4 and ta41 are changed whenever the timer b2 interrupt is generated. first time, ta41 = n, ta4 = n. second time, ta41 = p, ta4 = p. default values of registers idb0 and idb1: du0 = 1, dub0 = 0, du1 = 0, dub1 = 1. they are changed to du0 = 1, dub0 = 0, du1= 1 and dub1 = 0 when the third timer b2 interrupt is generated. (2)when inv11 = 0 (three-phase mode 0) inv01 = 0, ictb2 = 1 16 (the timer b2 interrupt is generated whenever timer b2 underflows) default value of the timer: ta4 = m. the ta4 register is changed whenever the timer b2 interrupt is generated. first time: ta4 = m. second tim:, ta4 = n. third time: ta4 = n. fourth time: ta4 = p. fifth time: ta4 = p. default values of registers idb0 and idb1: du0 = 1, dub0 = 0, du1 = 0, dub1 = 1. they are changed to du0 = 1, dub0 = 0, du1 = 1, and dub1 = 0 when the sixth timer b2 interrupt is generated. tb2s bit in the tabsr register inv13 (inv11=1(three-phase mode 1)) the above applies under the following conditions: invc0 = 00xx11xx 2 (x varies depending on each system) and invc1 = 010xxxx0 2 . u phase output signal (1) ( l active) ( h active) the value written to registers ta4 and ta41 becomes effective at the rising edge of the timer a1 reload control signal. transfer the values to the three-phase output shift register
12. timer page 127 9 2 3 f o 7 0 0 2 , 5 1 . b e f 0 0 . 2 . v e r 0 0 2 0 - 2 0 2 0 b 9 0 j e r ) t 6 2 / c 6 1 m , b 6 2 / c 6 1 m , a 6 2 / c 6 1 m ( p u o r g a 6 2 / c 6 1 m timer b2 u phase carrier wave signal wave u phase output signal * u phase u phase output signal * u phase u phase inv14 = 0 carrier wave: sawtooth waveform inv14 = 1 transfer to three-phase output shift register rewriting idb0, idb1 registers * internal signals. see the block diagram of the three-phase motor control timer function. shown here is a typical waveform for the case where invc0= 01xx110x 2 (x = set as suitable for the system) and invc1 = 010xxx00 2 . an example for changing pwm outputs is shown below. ? initial values of idb0 and idb1 registers: du0=0, dub0=1, du1=1, dub1=1. the register values are changed to du0=1, dub0=0, du1=1, dub1=1 a timer b2 interrupt occurs. start trigger signal for timer a4* timer a4 one-shot pulse* dead time dead time ( h active) ( l active) figure 12.3.10. sawtooth wave modulation operation
12. timer page 128 9 2 3 f o 7 0 0 2 , 5 1 . b e f 0 0 . 2 . v e r 0 0 2 0 - 2 0 2 0 b 9 0 j e r ) t 6 2 / c 6 1 m , b 6 2 / c 6 1 m , a 6 2 / c 6 1 m ( p u o r g a 6 2 / c 6 1 m 12.3.1 position-data-retain function this function is used to retain the position data synchronously with the three-phase waveform output.there are three position-data input pins for u, v, and w phases. a trigger to retain the position data (hereafter, this trigger is referred to as "retain trigger") can be selected by the retain-trigger polarity select bit(bit 3 of the position-data-retain function control register, at address 034e 16 ). this bit selects the retain trigger to be the falling edge of each positive phase, or the rising edge of each positive phase. 12.3.1.1 operation of the position-data-retain function figure 12.3.1.1.1 shows a usage example of the position-data-retain function (u phase) when the retain trigger is selected as the falling edge of the positive signal. (1) at the falling edge of the u-phase waveform ouput, the state at pin idu is transferred to the u- phase position data retain bit ( bit2 at address 034e 16 ). (2) until the next falling edge of the uphase waveform output,the above value is retained. figure 12.3.1.1.1 usage example of position-data-retain function ( u phase ) t r a n sfe rr ed carrier wave u-phase waveform output u-phase waveform output 1 2 t r a n sfe rr ed t r a n sfe rr ed t r a n sfe rr ed pin idu note: 1. the retain trigger is the falling edge of the positive signal. pdru bit in the rdrf register
12. timer page 129 9 2 3 f o 7 0 0 2 , 5 1 . b e f 0 0 . 2 . v e r 0 0 2 0 - 2 0 2 0 b 9 0 j e r ) t 6 2 / c 6 1 m , b 6 2 / c 6 1 m , a 6 2 / c 6 1 m ( p u o r g a 6 2 / c 6 1 m 12.3.1.2 position-data-retain function control register figure 12.3.1.2.1 shows the structure of the position-data-retain function contol register. figure 12.3.1.2.1. pdrf register 12.3.1.2.1 w-phase position data retain bit (pdrw) this bit is used to retain the input level at pin idw. 12.3.1.2.2 v-phase position data retain bit (pdrv) this bit is used to retain the input level at pin idv. 12.3.1.2.3 u-phase position data retain bit (pdru) t his bit is used to retain the input level at pin idu. 12.3.1.2.4 retain-trigger polarity select bit (pdrt) this bit is used to select the trigger polarity to retain the position data. when this bit is set to "0", the rising edge of each positive phase selected. when this bit is set to "1", the falling edge of each pocitive phase selected. p os i t i on- d ata-reta i n f unct i on contro l re gi ster (1) symbol address when reset pdrf 034e 16 xxxx 0000 2 ro ro ro rw bit name function bit symbol pdrw pdrv pdru w-phase position data retain bit input level at pin idu is read out. 0: "l" level 1: "h" level retain-trigger polarity select bit (b7-b4) rw pdrt v-phase position data retain bit nothing is assigned. when write, set to "0". when read, contents are indeterminate. u-phase position data retain bit input level at pin idv is read out. 0: "l" level 1: "h" level input level at pin idw is read out. 0: "l" level 1: "h" level 0: rising edge of positive phase 1: falling edge of positive phase note: 1. this register is valid only in the three-phase mode. b 7 b3 b 2b1b0
12. timer page 130 9 2 3 f o 7 0 0 2 , 5 1 . b e f 0 0 . 2 . v e r 0 0 2 0 - 2 0 2 0 b 9 0 j e r ) t 6 2 / c 6 1 m , b 6 2 / c 6 1 m , a 6 2 / c 6 1 m ( p u o r g a 6 2 / c 6 1 m figure 12.3.2.1. usage example of three-phse/port output switch function 12.3.2 three-phase/port output switch function when the invc03 bit in the invc0 register set to 1 (timer output enabled for three-phase motor control) and setting the pfci (i=0 to 5) in the pfcr register to 0 (i/o port), the three-phase pwm output pin (u, __ __ ___ u, v, v, w and w) functions as i/o port. each bit in the pfci bits (i=0 to 5) is applicable for each one of three-phase pwm output pins. figure 12.3.2.1 shows the example of three-phase/port output switch function. figure 12.3.2.2 shows the pfcr register and the three-phase protect control register. timer b2 u phase v phase w phase writing pfcr register (1) pfc0 bit : "1" pfc2 bit : "1" pfc4 bit : "0" functions as port p7 4 functions as port p7 2 writing pfcr register (1) pfc0 bit : "1" pfc2 bit : "0" pfc4 bit : "1" note: 1. a hazard may be generated at the output signal, depending on the output switch timing. also, do not generate (short) be swit ching to port output during the dead time of three-phase output.
12. timer page 131 9 2 3 f o 7 0 0 2 , 5 1 . b e f 0 0 . 2 . v e r 0 0 2 0 - 2 0 2 0 b 9 0 j e r ) t 6 2 / c 6 1 m , b 6 2 / c 6 1 m , a 6 2 / c 6 1 m ( p u o r g a 6 2 / c 6 1 m figure 12.3.2.2. pfcr register, and tprc register p ort f unct i on contro l re gi ster (1) symbol address when reset pfcr 0358 16 0011 1111 2 rw rw rw rw bit name function bit symbol pfc0 pfc1 pfc2 port p8 0 output function select bit (b7-b6) rw pfc3 nothing is assigned. when write, set to "0". when read, these contents are "0". 0: input/output port p8 0 1: three-phase pwm output (u phase output) pfc4 pfc5 rw rw port p8 1 output function select bit port p7 2 output function select bit port p7 3 output function select bit port p7 4 output function select bit port p7 5 output function select bit 0: input/output port p8 1 1: three-phase pwm output (u phase output) 0: input/output port p7 2 1: three-phase pwm output (v phase output) 0: input/output port p7 3 1: three-phase pwm output (v phase output) 0: input/output port p7 4 1: three-phase pwm output (w phase output) 0: input/output port p7 5 1: three-phase pwm output (w phase output) note: 1. this register is valid only when the invc03 bit in the invc0 register is set to "1"(three-phase motor control timer output enabled). write to this register after setting the tprc0 bit in the tprc register to "1" (write enable). b 7 b5 b 4 b3 b 2b1b0 th ree-p h ase protect contro l re gi ster symbol address when reset tprc 025a 16 00 16 rw rw bit name function bit symbol tprc0 three-phase protect control bit (b7-b1) nothing is assigned. when write, set to "0". when read, the contents are "0". enable write to pfcr register 0: write protected 1: write enabled b 7 b3 b 2b1b0
13. serial i/o page 132 9 2 3 f o 7 0 0 2 , 5 1 . b e f 0 0 . 2 . v e r 0 0 2 0 - 2 0 2 0 b 9 0 j e r ) t 6 2 / c 6 1 m , b 6 2 / c 6 1 m , a 6 2 / c 6 1 m ( p u o r g a 6 2 / c 6 1 m 13. serial i/o note uart0 is not available in the 42-pin package. serial i/o is configured with three channels: uart0 to uart2. 13.1. uarti (i=0 to 2) uarti each have an exclusive timer to generate a transfer clock, so they operate independently of each other. figure 13.1.1 shows the block diagram of uarti. figures 13.1.2 and 13.1.3 shows the block diagram of the uarti transmit/receive. uarti has the following modes: ? clock synchronous serial i/o mode ? clock asynchronous serial i/o mode (uart mode). ? special mode 1 (i 2 c bus mode) : uart2 ? special mode 2 : uart2 ? special mode 3 (bus collision detection function, iebus mode) : uart2 ? special mode 4 (sim mode) : uart2 figures 13.1.4 to 13.1.9 show the uarti-related registers. refer to tables listing each mode for register setting.
13. serial i/o page 133 9 2 3 f o 7 0 0 2 , 5 1 . b e f 0 0 . 2 . v e r 0 0 2 0 - 2 0 2 0 b 9 0 j e r ) t 6 2 / c 6 1 m , b 6 2 / c 6 1 m , a 6 2 / c 6 1 m ( p u o r g a 6 2 / c 6 1 m clock synchronous type (when internal clock is selected) clock synchronous type (when external clock is selected) clock source selection internal external cts/rts disabled cts/rts selected rxd 0 1 / (n 0 +1) 1/16 1/16 1/2 u0brg registe r clk 0 cts 0 / rts 0 f 1sio or f 2sio f 8sio f 32sio v cc rts 0 cts 0 txd 0 (uart0) clk1 to clk0 00 2 01 2 10 2 ckdir=0 ckdir=1 ckpol ckdir=0 ckdir= 1 crs=1 crs=0 crd=0 crd=1 rcsp=0 rcsp=1 v cc crd=0 crd=1 uart reception clock synchronous type uart transmission clock synchronous type clock synchronous type (when internal clock is selected) receive clock transmit clock reception control circuit transmission control circuit transmit/ receive unit clk polarity reversing circuit cts/rts disabled cts 0 from uart 1 uart reception clock synchronous type rxd 1 txd 1 (uart1) 1 / (n 1 +1) 1/16 1/16 1/2 u1brg register clk 1 f 1sio or f 2sio f 8sio f 32sio clk1 to clk0 00 2 01 2 10 2 ckdir=0 ckdir=1 ckpol ckdir=0 ckdir= 1 v cc crd=0 crd=1 clkmd0=0 clkmd1=0 crs=1 crs=0 rcsp=0 rcsp=1 clkmd0=1 clkmd1=1 clock source selection internal external uart transmission clock synchronous type clock synchronous type (when internal clock is selected) receive clock transmit clock reception control circuit transmission control circuit transmit/ receive unit clock synchronous type (when external clock is selected) clock synchronous type (when internal clock is selected) clk polarity reversing circuit rts1 cts1 clock output pin select cts/rts disable d cts/rts disable d cts/rts selecte d cts 0 from uart 0 cts 1 / rts 1 / cts 0 / clks 1 i = 0 to 2 n i : values set to the uibrg register smd2 to smd0, ckdir: bits in the uimr clk1 to clk0, ckpol, crd, crs: bits in the uic0 register s clkmd0, clkmd1, rcsp: bits in the ucon register rxd 2 clk 2 cts 2 / rts 2 rts 2 cts 2 txd 2 (uart2) 1 / (n 2 +1) 1/16 1/16 1/2 u2brg registe r f 1sio or f 2sio f 8sio f 32sio clk1 to clk0 00 2 01 2 10 2 ckdir=0 ckdir=1 ckpol ckdir=0 ckdir= 1 crs=1 crs=0 v cc crd=0 crd=1 reception control circuit transmission control circuit uart reception clock synchronous type uart transmission clock synchronous type clock synchronous type (when internal clock is selected) receive clock transmit clock rxd polarity reversing circuit internal external clock source selection txd polarity reversing circuit transmit/ receive unit clock synchronous type (when internal clock is selected) clock synchronous type (when external clock is selected) clk polarity reversing circuit cts/rts disabled cts/rts disabled cts/rts selecte d main clock, pll clock, or on-chip oscillator clock 1/2 1/8 1/4 f 1sio f 2sio f 8sio f 32sio f 1sio or f 2sio pclk1=1 pclk1=0 smd2 to smd0 smd2 to smd0 smd2 to smd0 figure 13.1.1. block diagram of uarti (i = 0 to 2)
13. serial i/o page 134 9 2 3 f o 7 0 0 2 , 5 1 . b e f 0 0 . 2 . v e r 0 0 2 0 - 2 0 2 0 b 9 0 j e r ) t 6 2 / c 6 1 m , b 6 2 / c 6 1 m , a 6 2 / c 6 1 m ( p u o r g a 6 2 / c 6 1 m sp sp pa r 2sp 1sp uart uart (7 bits) uart (8 bits) uart (7 bits) uart (9 bits) clock synchronous type clock synchronous type txdi uarti transmit register par enabled par disabled d 8 d 7 d 6 d 5 d 4 d 3 d 2 d 1 d 0 sp: stop bit par: parity bit uarti ? transmit buffer register msb/lsb conversion circuit uart (8 bits) uart (9 bits) clock synchronous type uarti receive buffer register uarti receive registe r 2sp 1sp stps=0 pa r enabled par disabled uart uart (7 bits) uart (9 bits) clock synchronous type clock synchronous type uart (7 bits) uart (8 bits ) rxdi clock synchronous type uart (8 bits) uart (9 bits) address 03a6 16 address 03a7 16 address 03ae 16 address 03af 16 address 03a2 16 address 03a3 16 address 03aa 16 address 03ab 16 data bus low-order bit s msb/lsb conversion circuit d 7 d 6 d 5 d 4 d 3 d 2 d 1 d 0 d 8 0000000 sp sp par 0 data bus high-order bits stps=1 prye=0 prye=1 stps=0 stps=1 prye=0 prye=1 smd2 to smd0, stps, prye, iopol, ckdir : bit in the uimr register 0 00 1 11 smd2 to smd0 0 1 smd2 to smd0 1 1 0 0 figure 13.1.2. block diagram of uarti (i = 0, 1) transmit/receive unit
13. serial i/o page 135 9 2 3 f o 7 0 0 2 , 5 1 . b e f 0 0 . 2 . v e r 0 0 2 0 - 2 0 2 0 b 9 0 j e r ) t 6 2 / c 6 1 m , b 6 2 / c 6 1 m , a 6 2 / c 6 1 m ( p u o r g a 6 2 / c 6 1 m sp sp pa r 2sp 1sp uart uart (7 bits) uart (8 bits) uart(7 bits) uart (9 bits) clock synchronous type clock synchronous type data bus low-order bits txd2 uarti transmit registe r par disabled par enabled d 8 d 7 d 6 d 5 d 4 d 3 d 2 d 1 d 0 uart2 transmit buffer register uart (8 bits) uart (9 bits) clock synchronous type uart2 receive buffer registe r uarti receive registe r 2sp 1sp uart (7 bits) uart (8 bits) uart(7 bits) uart (9 bits) clock synchronous type clock synchronous type rxd2 uart (8 bits) uart (9 bits) address 037e 16 address 037f 16 address 037a 16 address 037b 16 data bus high-order bit s d 7 d 6 d 5 d 4 d 3 d 2 d 1 d 0 d 8 0000000 sp sp par 0 reverse no revers e error signal output circui t rxd data reverse circuit error signal output enable error signal output disable reverse no reverse logic reverse circuit + msb/lsb conversion circuit logic reverse circuit + msb/lsb conversion circuit par enabled par disabled uart clock synchronous type txd data reverse circuit sp: stop bit par: parity bit stps=0 stps=1 prye=0 prye=1 stps=0 stps=1 prye=0 prye=1 iopol=0 iopol=1 iopol =0 iopol =1 u2ere =0 u2ere =1 smd2 to smd0, stps, prye, iopol, ckdir : bit in the u2mr register u2ere : bit in the u2c1 register 0 1 smd2 to smd0 11 0 0 0 1 smd2 to smd0 1 1 0 0 figure 13.1.3. block diagram of uart2 transmit/receive unit
13. serial i/o page 136 9 2 3 f o 7 0 0 2 , 5 1 . b e f 0 0 . 2 . v e r 0 0 2 0 - 2 0 2 0 b 9 0 j e r ) t 6 2 / c 6 1 m , b 6 2 / c 6 1 m , a 6 2 / c 6 1 m ( p u o r g a 6 2 / c 6 1 m figure 13.1.4. u0tb to u2tb registers, u0rb to u2rb registers, u0brg to u2brg registers (b15) b7 b0 (b8) b7 b0 uarti transmit buffer register (i=0 to 2) (1) function transmit data nothing is assigned. when write, set to "0". when read, its content is indeterminate. symbol address after reset u0tb 03a3 16 -03a2 16 indeterminate u1tb 03ab 16 -03aa 16 indeterminate u2tb 037b 16 -037a 16 indeterminate rw notes: 1. use mov instruction to write to this register. wo b7 uarti baud rate generation register (i=0 to 2) (1, 2, 3) b0 symbol address after reset u0brg 03a1 16 indeterminate u1brg 03a9 16 indeterminate u2brg 0379 16 indeterminate function assuming that set value = n, uibrg divides the count source by n + 1 00 16 to ff 16 setting range notes: 1. write to this register while serial i/o is neither transmitting nor receiving. 2. use mov instruction to write to this register. the transfer clock is shown below when the setting value in the uibrg register is set as n. (1) when the ckdir bit in the uimr register to 0 (internal clock) ? clock synchronous serial i/o mode : fj/(2(n+1)) ? clock asynchronous serial i/o (uart) mode : fj/(16(n+1)) (2) when the ckdir bit in the uimr register to 1 (external clock) ? clock synchronous serial i/o mode : f ext ? clock asynchronous serial i/o (uart) mode : f ext /(16(n+1)) fj : f1sio, f2sio, f8sio, f32sio f ext : input from clki pin 3. set the uibrg register after setting the clk1 and clk0 bits in the uic0 registers. rw wo notes: 1. when the smd2 to smd0 bits in the uimr register are set to 000 2 (serial i/o disabled) or the re bit in the uic1 register is set to 0 (reception disabled), all of the sum, per, fer and oer bits are set to 0 (no error). the sum bit is set to 0 (no error) when all of the per, fer and oer bits are set to 0 (no error). also, the per and fer bits are set to 0 by reading the lower byte of the uirb register. 2. the abt bit is set to 0 by setting to 0 by program. (writing 1 has no effect.) nothing is assigned at the bit 11 in the u0rb and u1rb registers. when write, set to "0". when read, its content is "0 ". (b15) symbol address after reset u0rb 03a7 16 -03a6 16 indeterminate u1rb 03af 16 -03ae 16 indeterminate u2rb 037f 16 -037e 16 indeterminate b7 b0 (b8) b7 b0 uarti receive buffer register (i=0 to 2) function bit name bit symbol 0 : no framing error 1 : framing error found 0 : no parity error 1 : parity error found 0 : no error 1 : error found oer fer per sum overrun error flag (1) framing error flag (1) parity error flag (1) error sum flag (1) 0 : no overrun error 1 : overrun error found receive data (d 7 to d 0 ) abt arbitration lost detecting flag (2) 0 : not detected 1 : detected rw ro (b7-b0) (b10-b9) receive data (d 8 ) (b8) nothing is assigned. when write, set to "0". when read, its content is indeterminate. rw ro ro ro ro ro
13. serial i/o page 137 9 2 3 f o 7 0 0 2 , 5 1 . b e f 0 0 . 2 . v e r 0 0 2 0 - 2 0 2 0 b 9 0 j e r ) t 6 2 / c 6 1 m , b 6 2 / c 6 1 m , a 6 2 / c 6 1 m ( p u o r g a 6 2 / c 6 1 m uarti transmit/receive mode register (i = 0, 1) symbol address after reset u0mr, u1mr 03a0 16 , 03a8 16 00 16 b7 b6 b5 b4 b3 b2 b1 b0 bit name bit symbol rw ckdir smd1 smd0 serial i/o mode select bit (2) smd2 internal/external clock select bit stps pry prye (b7) parity enable bit 0 : internal clock 1 : external clock (1) stop bit length select bit odd/even parity select bit reserve bit 0 : one stop bit 1 : two stop bits 0 : parity disabled 1 : parity enabled 0 0 0 : serial i/o disabled 0 0 1 : clock synchronous serial i/o mode 1 0 0 : uart mode transfer data 7 bits long 1 0 1 : uart mode transfer data 8 bits long 1 1 0 : uart mode transfer data 9 bits long do not set value other than the above b2 b1 b0 effective when prye = 1 0 : odd parity 1 : even parity write to "0" functio n rw rw rw rw rw rw rw rw uart2 transmit/receive mode register symbol address after reset u2mr 0378 16 00 16 b7 b6 b5 b4 b3 b2 b1 b0 bit name bit symbol rw ckdir smd1 smd0 serial i/o mode select bit (2) smd2 internal/external clock select bit stps pry prye iopol parity enable bit 0 : internal clock 1 : external clock (1) stop bit length select bit odd/even parity select bit txd, rxd i/o polarity reverse bit 0 : one stop bit 1 : two stop bits 0 : parity disabled 1 : parity enabled 0 0 0 : serial i/o disabled 0 0 1 : clock synchronous serial i/o mode 0 1 0 : i 2 c bus mode 1 0 0 : uart mode transfer data 7 bits long 1 0 1 : uart mode transfer data 8 bits long 1 1 0 : uart mode transfer data 9 bits long must not be set except above b2 b1 b0 effective when prye = 1 0 : odd parity 1 : even parity 0 : no reverse 1 : reverse functio n rw rw rw rw rw rw rw rw (3) notes: 1. set the corresponding port direction bit for each clki pin to 0 (input mode). 2. to receive data, set the corresponding port direction bit for each rxdi pin to 0 (input mode). notes: 1. set the corresponding port direction bit for each clk2 pin to 0 (input mode). 2. to receive data, set the corresponding port direction bit for each rxd2 pin to 0 (input mode). 3. set the corresponding port direction bit for scl2 and sda2 pins to 0 (input mode). figure 13.1.5. u0mr to u2mr registers
13. serial i/o page 138 9 2 3 f o 7 0 0 2 , 5 1 . b e f 0 0 . 2 . v e r 0 0 2 0 - 2 0 2 0 b 9 0 j e r ) t 6 2 / c 6 1 m , b 6 2 / c 6 1 m , a 6 2 / c 6 1 m ( p u o r g a 6 2 / c 6 1 m figure 13.1.6. u0c0 to u2c0 registers and ucon register uarti transmit/receive control rregister 0 (i=0 to 2) symbol address after reset u0c0 to u2c0 03a4 16 , 03ac 16 , 037c 16 00001000 2 b7 b6 b5 b4 b3 b2 b1 b0 function txept clk1 clk0 crs crd nch ckpol brg count source select bit transmit register empty flag 0 : transmit data is output at falling edge of transfer clock and receive data is input at rising edge 1 : transmit data is output at rising edge of transfer clock and receive data is input at falling edge clk polarity select bit cts/rts function select bit cts/rts disable bi t data output select bit (5) 0 0 : f 1sio or f 2sio is selected 0 1 : f 8sio is selected 1 0 : f 32sio is selected 1 1 : do not set b1 b0 0 : lsb first 1 : msb first 0 : data in transmit register (during transmission) 1 : no data in transmit register (transmission completed) 0 : cts/rts function enabled 1 : cts/rts function disabled (p6 0 , p6 4 and p7 3 can be used as i/o ports) (6) 0 : txdi/sda2 and scl2 pins are cmos output 1 : txdi/sda2 and scl2 pins are n-channel open-drain output (4) uform transfer format select bit (2) effective when crd is set to "0" 0 : cts function is selected (1) 1 : rts function is selected bit name bit symbol notes: 1. set the corresponding port direction bit for each ctsi pin to 0 (input mode). 2. effective when the smd2 to smd0 bits in the umr register to "001 2 "(clock synchronous serial i/o mode) or "010 2 " (uart mode transfer data 8 bits long). set the uform bit to "1" when the smd2 to smd0 bits are set to "101 2 " (i 2 c bus mode) and "0" when they are set to"100 2 " (uart mode transfer data 7 bits long) or "110 2 " ( uart mode transfer data 9 bits long). 3. cts 1 /rts 1 can be used when the clkmd1 bit in the ucon register is set to 0 (only clk 1 output) and the rcsp bit in the ucon register is set to 0 (cts 0 /rts 0 not separated). 4. sda2 and scl2 are effective when i = 2. 5. when the smd2 to smd0 bits in uimr regiser are set to 000 2 (serial i/o disable), do not set nch bit to 1 (txdi/sda2 and scl2 pins are n-channel open-drain output). 6. when the u1map bit in pacr register is 1 (p7 3 to p7 0 ), cts/rts pin in uart1 is assigned to p7 0 . 7. when the clk1 and clk0 bit settings are changed, set the uibrg register. rw rw rw rw rw rw rw rw ro (3 ) (7) uart transmit/receive control register 2 symbol address after reset ucon 03b0 16 x0000000 2 b7 b6 b5 b4 b3 b2 b1 b0 bit name bit symbol rw function clkmd0 clkmd1 uart0 transmit interrupt cause select bit uart0 continuous receive mode enable bit 0: continuous receive mode disabled 1: continuous receive mode enable uart1 continuous receive mode enable bit uart1 clk/clks select bit 0 uart1 transmit interrupt cause select bit 0: transmit buffer empty (tl = 1) 1: transmission completed (txept = 1) 0: transmit buffer empty (tl = 1) 1: transmission completed (txept = 1) 0: continuous receive mode disabled 1: continuous receive mode enabled nothing is assigned. when write, set to 0 . when read, the content is indeterminate u0irs u1irs u0rrm u1rrm uart1 clk/clks select bit 1 (1) effective when clkmd1 bit is set to 1 0: clock output from clk1 1: clock output from clks1 rcsp separate uart0 cts/rts bit (b7) rw rw rw rw rw rw rw notes: 1. to use more than one transfer clock output pins, set the ckdir bit in the u1mr register to 0 (internal clock). 2. when the u1map bit in pacr register is set to 1 (p7 3 to p7 0 ), cts 0 is supplied from the p7 0 pin. 0: output from clk1 only 1: transfer clock output from multiple pins function selected 0: cts/rts shared pin 1: cts/rts separated (cts 0 supplied from the p6 4 pin) (2)
13. serial i/o page 139 9 2 3 f o 7 0 0 2 , 5 1 . b e f 0 0 . 2 . v e r 0 0 2 0 - 2 0 2 0 b 9 0 j e r ) t 6 2 / c 6 1 m , b 6 2 / c 6 1 m , a 6 2 / c 6 1 m ( p u o r g a 6 2 / c 6 1 m figure 13.1.7. u0c1 to u2c1 registers, pacr register pin assignment control register (1) symbpl address after reset pacr 025d 16 00 16 bit name function bit symbol rw b7 b6 b5 b4 b3 b2 b1 b0 pin enabling bit nothing is assigned. when write, set to 0 . when read, its content is 0 . rw (b6-b3) 001 : 42 pin 100 : 48 pin all other values are reserved. do not use. pacr0 pacr1 pacr2 rw rw reserved bits u1map uart1 pin remapping bit uart1 pins assigned to 0 : p6 7 to p6 4 1 : p7 3 to p7 0 rw notes: 1. set the pacr register by the next instruction after setting the prc2 bit in the prcr register to "1"(write enable). uarti transmit/receive control register 1 (i=0, 1) symbol address after reset u0c1, u1c1 03a5 16 ,03ad 16 00000010 2 b7 b6 b5 b4 b3 b2 b1 b0 bit name bit symbol rw function te ti re ri transmit enable bit receive enable bit receive complete flag transmit buffer empty flag 0 : transmission disabled 1 : transmission enabled 0 : data in uitb register 1 : no data in uitb register 0 : reception disabled 1 : reception enabled 0 : no data in uirb register 1 : data in uirb register nothing is assigned. when write, set 0 . when read, the contents are 0 . uart2 transmit/receive control register 1 symbol address after reset u2c1 037d 16 00000010 2 b7 b6 b5 b4 b3 b2 b1 b0 bit name bit symbol function te ti re ri transmit enable bit receive enable bit receive complete flag transmit buffer empty flag 0 : transmission disabled 1 : transmission enabled 0 : reception disabled 1 : reception enabled u2irs uart2 transmit interrupt cause select bit 0 : transmit buffer empty (ti = 1) 1 : transmit is completed (txept = 1) u2rrm uart2 continuous receive mode enable bit 0 : continuous receive mode disabled 1 : continuous receive mode enabled data logic select bit 0 : no reverse 1 : reverse u2lch u2ere error signal output enable bit 0 : output disabled 1 : output enabled rw rw ro ro rw rw rw rw rw rw rw ro ro (b7-b4) 0 : data in u2tb register 1 : no data in u2tb register 0 : no data in u2rb register 1 : data in u2rb register
13. serial i/o page 140 9 2 3 f o 7 0 0 2 , 5 1 . b e f 0 0 . 2 . v e r 0 0 2 0 - 2 0 2 0 b 9 0 j e r ) t 6 2 / c 6 1 m , b 6 2 / c 6 1 m , a 6 2 / c 6 1 m ( p u o r g a 6 2 / c 6 1 m figure 13.1.8. u2smr register and u2smr2 register uart2 special mode register symbol address after reset u2smr 0377 16 x0000000 2 b7 b6 b5 b4 b3 b2 b1 b0 bit name bit symbol function abscs acse sss i 2 c bus mode select bit bus busy flag 0 : stop condition detected 1 : start condition detected (busy) bus collision detect sampling clock select bit arbitration lost detecting flag control bit 0 : other than i 2 c bus mode 1 : i 2 c bus mode 0 : update per bit 1 : update per byte iicm abc bbs 0 : not synchronized to r x di 1 : synchronized to r x di (2) set to 0 transmit start condition select bit 0 : rising edge of transfer clock 1 : underflow signal of timer a0 auto clear function select bit of transmit enable bit 0 : no auto clear function 1 : auto clear at occurrence of bus collision notes: 1: the bbs bit is set to 0 by writing 0" by program. (writing 1 has no effect). 2: when a transfer begins, the sss bit is set to 0 (not synchronized to r x di). (1) nothing is assigned. when write, set 0 . when read, its content is indeterminate. rw rw rw rw rw rw rw rw (b7) 0 (b3) reserved bit uart2 special mode register 2 symbol address after reset u2smr2 0376 16 x0000000 2 b7 b6 b5 b4 b3 b2 b1 b0 bit name bit symbol rw function stac swc2 sdhi i c bus mode select bit 2 scl 2 wait output bit 0 : disabled 1 : enabled sda 2 output stop bit uart initialization bit clock-synchronous bit refer to table 13.12 0 : disabled 1 : enabled iicm2 csc swc als 0 : disabled 1 : enabled sda 2 output disable bit scl 2 wait output bit 2 0: enabled 1: disabled (high impedance) 0 : disabled 1 : enabled 0: transfer clock 1: l output 2 nothing is assigned. when write, set 0 . when read, its content is indeterminate. rw rw rw rw rw rw rw (b7)
13. serial i/o page 141 9 2 3 f o 7 0 0 2 , 5 1 . b e f 0 0 . 2 . v e r 0 0 2 0 - 2 0 2 0 b 9 0 j e r ) t 6 2 / c 6 1 m , b 6 2 / c 6 1 m , a 6 2 / c 6 1 m ( p u o r g a 6 2 / c 6 1 m uart2 special mode register 3 symbol address after reset u2smr3 0375 16 000x0x0x 2 b7 b6 b5 b4 b3 b2 b1 b0 bit name bit symbol function dl2 sda digital delay setup bit (1, 2) dl0 dl1 0 0 0 : without delay 0 0 1 : 1 to 2 cycle(s) of uibrg count source 0 1 0 : 2 to 3 cycles of uibrg count source 0 1 1 : 3 to 4 cycles of uibrg count source 1 0 0 : 4 to 5 cycles of uibrg count source 1 0 1 : 5 to 6 cycles of uibrg count source 1 1 0 : 6 to 7 cycles of uibrg count source 1 1 1 : 7 to 8 cycles of uibrg count source nothing is assigned. when write, set 0 . when read, its content is indeterminate. b7 b6 b5 0 : without clock delay 1 : with clock delay clock phase set bit 0 : clki is cmos output 1 : clki is n-channel open drain output clock output select bit ckph nodc rw rw rw rw rw rw (b0) nothing is assigned. when write, set 0 . when read, its content is indeterminate. nothing is assigned. when write, set 0 . when read, its content is indeterminate. (b2) (b4) notes: 1. the dl2 to dl0 bits are used to generate a delay in sda2 output by digital means during i 2 c bus mode. in other than i 2 c bus mode, set these bits to 000 2 (no delay). 2. the amount of delay varies with the load on scl2 and sda2 pins. also, when using an external clock, the amount of delay increases by about 100 ns. figure 13.1.9. u2smr3 register and u2smr4 register uart2 special mode register 4 symbol address after reset u2smr4 0374 16 00 16 b7 b6 b5 b4 b3 b2 b1 b0 bit name bit symbol rw function ackc sclhi swc9 ack data bit stareq rstareq stpreq ackd 0: disabled 1: enabled 0: ack 1: nack 0: serial i/o data output 1: ack data output note: 1. set to 0 when each condition is generated. stspsel scl 2 wait bit 3 rw rw rw rw rw rw rw rw start condition generate bit (1) restart condition generate bit (1) stop condition ack data output scl 2 output stop scl 2 , sda 2 output 0: clear 1: start 0: clear 1: start 0: clear 1: start 0: start and stop conditions not output 1: start and stop conditions output 0: scl 2 l hold disabled 1: scl 2 l hold enabled
13. serial i/o page 142 9 2 3 f o 7 0 0 2 , 5 1 . b e f 0 0 . 2 . v e r 0 0 2 0 - 2 0 2 0 b 9 0 j e r ) t 6 2 / c 6 1 m , b 6 2 / c 6 1 m , a 6 2 / c 6 1 m ( p u o r g a 6 2 / c 6 1 m 13.1.1. clock synchronous serial i/o mode the clock synchronous serial i/o mode uses a transfer clock to transmit and receive data. table 13.1.1.1 lists the specifications of the clock synchronous serial i/o mode. table 13.1.1.2 lists the registers used in clock synchronous serial i/o mode and the register values set. table 13.1.1.1. clock synchronous serial i/o mode specifications item specification transfer data format ? transfer data length: 8 bits transfer clock ? the ckdir bit in the uimr(i=0 to 2) register is set to 0 (internal clock) : fj/ (2(n+1)) fj = f 1sio , f 2sio , f 8sio , f 32sio . n: setting value of uibrg register 00 16 to ff 16 ? the ckdir bit is set to 1 (external clock ) : input from clki pin transmission, reception control _______ _______ _______ _______ ? selectable from cts function, rts function or cts/rts function disable transmission start condition ? before transmission can start, the following requirements must be met (1) _ the te bit in the uic1 register is set to "1" (transmission enabled) _ the ti bit in the uic1 register is set to "0" (data present in uitb register) _______ _______ _ if cts function is selected, input on the ctsi pin is l reception start condition ? before reception can start, the following requirements must be met (1) _ the re bit in the uic1 register is set to "1" (reception enabled) _ the te bit in the uic1 register is set to "1" (transmission enabled) _ the ti bit in the uic1 register is set to "0" (data present in the uitb register) ? for transmission, one of the following conditions can be selected _ the uiirs bit (3) is set to "0" (transmit buffer empty): when transferring data from the uitb register to the uarti transmit register (at start of transmission) _ the uiirs bit is set to "1" (transfer completed): when the serial i/o finished sending data from the uarti transmit register ? for reception when transferring data from the uarti receive register to the uirb register (at completion of reception) error detection ? overrun error (2) this error occurs if the serial i/o started receiving the next data before reading the uirb register and received the 7th bit of the next data select function ? clk polarity selection transfer data input/output can be chosen to occur synchronously with the rising or the falling edge of the transfer clock ? lsb first, msb first selection whether to start sending/receiving data beginning with bit 0 or beginning with bit 7 can be selected ? continuous receive mode selection reception is enabled immediately by reading the uirb register ? switching serial data logic (uart2) this function reverses the logic value of the transmit/receive data ? transfer clock output from multiple pins selection (uart1) the output pin can be selected in a program from two uart1 transfer clock pins that have been set _______ _______ ? separate cts/rts pins (uart0) _________ _________ cts 0 and rts 0 are input/output from separate pins ? uart1 pin remapping selection the uart1 pin can be selected from the p6 7 to p6 4 or p7 3 to p7 0 . notes: 1. when an external clock is selected, the conditions must be met while if the ckpol bit in the uic0 register 0 (transmit data output at the falling edge and the receive data taken in at the rising edge of the transfer clock), the external clock is in the high state; if the ckpol bit in the uic0 register 1 (transmit data output at the rising edge and the receive data taken in at the falling edge of the transfer clock), the external clock is in the low state. 2. if an overrun error occurs, bits 8 to 0 in uirb register are undefined. the ir bit in the siric register remains unchanged. 3. the u0irs and u1irs bits respectively are the ucon register bits 0 and 1; the u2irs bit is the u2c1 register bit 4.
13. serial i/o page 143 9 2 3 f o 7 0 0 2 , 5 1 . b e f 0 0 . 2 . v e r 0 0 2 0 - 2 0 2 0 b 9 0 j e r ) t 6 2 / c 6 1 m , b 6 2 / c 6 1 m , a 6 2 / c 6 1 m ( p u o r g a 6 2 / c 6 1 m table 13.1.1. 2. registers to be used and settings in clock synchronous serial i/o mode register bit function uitb (3) 0 to 7 set transmission data uirb (3) 0 to 7 reception data can be read oer overrun error flag uibrg 0 to 7 set a transfer rate uimr (3) smd2 to smd0 set to 001 2 ckdir select the internal clock or external clock iopol(i=2) (4) set to 0 uic0 clk1 to clk0 select the count source for the uibrg register crs _______ _______ select cts or rts to use txept transmit register empty flag crd _______ _______ enable or disable the cts or rts function nch select txdi pin output mode ckpol select the transfer clock polarity uform select the lsb first or msb first uic1 te set this bit to 1 to enable transmission/reception ti transmit buffer empty flag re set this bit to 1 to enable reception ri reception complete flag u2irs (1) select the source of uart2 transmit interrupt u2rrm (1) set this bit to 1 to use uart2 continuous receive mode u2lch (3) set this bit to 1 to use uart2 inverted data logic u2ere (3) set to 0 u2smr 0 to 7 set to 0 u2smr2 0 to 7 set to 0 u2smr3 0 to 2 set to 0 nodc select clock output mode 4 to 7 set to 0 u2smr4 0 to 7 set to 0 ucon u0irs, u1irs select the source of uart0/uart1 transmit interrupt u0rrm, u1rrm set this bit to 1 to use continuous receive mode clkmd0 select the transfer clock output pin when clkmd1 = 1 clkmd1 set this bit to 1 to output uart1 transfer clock from two pins rcsp _________ set this bit to 1 to accept as input the uart0 cts 0 signal from the p6 4 pin or p7 0 pin 7 set to 0 notes: 1. set bit 4 and bit 5 in the u0c1 and u1c1 register are set to 0 . the u0irs, u1irs, u0rrm and u1rrm bits are in the ucon register. 2. not all register bits are described above. set those bits to 0 when writing to the registers in clock synchro- nous serial i/o mode. 3. set the bit 6 and bit 7 in the u0c1 and u1c1 register to "0". 4. set the bit 7 in the u0mr and u1mr register to "0". i=0 to 2
13. serial i/o page 144 9 2 3 f o 7 0 0 2 , 5 1 . b e f 0 0 . 2 . v e r 0 0 2 0 - 2 0 2 0 b 9 0 j e r ) t 6 2 / c 6 1 m , b 6 2 / c 6 1 m , a 6 2 / c 6 1 m ( p u o r g a 6 2 / c 6 1 m table 13.1.1.3 lists the functions of the input/output pins during clock synchronous serial i/o mode. table 13.3 shows pin functions for the case where the multiple transfer clock output pin select function is dese- lected. table 13.1.1.4 lists the p6 4 pin functions during clock synchronous serial i/o mode. note that for a period from when the uarti operation mode is selected to when transfer starts, the txdi pin outputs an h . (if the n-channel open-drain output is selected, this pin is in a high-impedance state.) table 13.1.1.3. pin functions (1) ( when not select multiple transfer clock output pin function ) pin name function method of selection txdi (i = 0 to 2) (p6 3 , p6 7 , p7 0 ) serial data output serial data input transfer clock output transfer clock input i/o port (outputs dummy data when performing reception only) rxdi (p6 2 , p6 6 , p7 1 ) clki (p6 1 , p6 5 , p7 2 ) set the ckdir bit in the uimr register to "0" set the ckdir bit in the uimr register to "1" set the pd6_1 bit and pd6_5 bit in the pd6 register, and the pd7_2 bit in the pd7 register to "0" set the pd6_2 bit and pd6_6 bit in the pd6 register, and pd7_1 bit in the pd7 register to "0"(can be used as an input port when performing transmission only) set the crd bit in the uic0 register to "0" set the crs bit in the uic0 register to "0" set the pd6_0 bit and pd6_4 bit in the pd6 register is set to "0", the pd7_3 bit in the pd7 register to "0" set the crd bit in the uic0 register to "0" set the crs bit in the uic0 register to "1" set the crd bit in the uic0 register to "1" cts input rts output ctsi/rtsi (p6 0 , p6 4 , p7 3 ) note: 1. when the u1map bit in pacr register is 1 (p7 3 to p7 0 ), uart1 pin is assgined to p7 3 to p7 0 . pin function bit set value u1c0 register ucon register pd6 register crd crs rcsp clkmd1 clkmd0 pd6_4 p6 4 1 0 0 input: 0, output: 1 cts 1 000 0 0 rts 1 1 1 00 cts 0 (2) 0 clks 1 0 0 00 1 (3) 1 notes: 1. when the u1map bit in pacr register is 1 (p7 3 to p7 0 ), this table lists the p7 0 functions. 2. in addition to this, set the crd bit in the u0c0 register to 0 (ct0 0 /rt0 0 enabled) and the crs bit in the u0c0 register to 1 (rts 0 selected). 3. when the clkmd1 bit is set to "1" and the clkmd0 bit is set to "0", the following logiclevels are output: ? high if the clkpol bit in the u1c0 register is set to "0" ? low if the clkpol bit in the u1c0 register is set to "1" table 13.1.1.4. p6 4 pin functions (1)
13. serial i/o page 145 9 2 3 f o 7 0 0 2 , 5 1 . b e f 0 0 . 2 . v e r 0 0 2 0 - 2 0 2 0 b 9 0 j e r ) t 6 2 / c 6 1 m , b 6 2 / c 6 1 m , a 6 2 / c 6 1 m ( p u o r g a 6 2 / c 6 1 m figure 13.1.1.1. typical transmit/receive timings in clock synchronous serial i/o mode d 0 d 1 d 2 d 3 d 4 d 5 d 6 d 7 d 0 d 1 d 2 d 3 d 4 d 5 d 6 d 7 d 0 d 1 d 2 d 3 d 4 d 5 d 6 d 7 tc t clk stopped pulsing because the te bit = 0 write data to the uitb register tc = t clk = 2(n + 1) / fj fj: frequency of uibrg count source (f 1sio , f 2sio , f 8sio , f 32sio ) n: value set to uibrg register i: 0 to 2 transfer clock uic1 register te bit uic1 register ti bit clki txdi h l 0 1 0 1 0 1 ctsi 0 1 stopped pulsing because ctsi = h 1 / f ext write dummy data to uitb register uic1 register te bit uic1 register ti bit clki rxdi uic1 register ri bit rtsi h l 0 1 0 1 0 1 uic1 register re bit 0 1 receive data is taken in transferred from uitb register to uarti transmit register read out from uirb register f ext : frequency of external clock transferred from uarti receive register to uirb register siric register ir bit 0 1 d 0 d 1 d 2 d 3 d 4 d 5 d 6 d 7 d 0 d 1 d 2 d 3 d 4 d 5 transferred from uitb register to uarti transmit register make sure the following conditions are met when input to the clki pin before receiving data is high: ? uic0 register te bit is set to "1" (transmit enabled) ? uic0 register re bit is set to "1" (receive enabled) ? write dummy data to the uitb register the above timing diagram applies to the case where the register bits are set as follows: ? the ckdir bit in the uimr register is set to "0" (internal clock) ? the crd bit in the uic0 register is set to "0" (cts/rts enabled); crs bit is set to "0" (cts selected) ? the ckpol bit in the uic0 register is set to "0" (transmit data output at the falling edge and receive data taken in at the ri sing edge of the transfer clock) ? the uiirs bit is set to "0" (an interrupt request occurs when the transmit buffer becomes empty): u0irs bit is the bit 0 in th e ucon register u1irs bit is the bit 1 in the ucon register, and u2irs bit is the bit 4 in the u2c1 register. cleared to 0 when interrupt request is accepted, or cleared to 0 by program cleared to 0 when interrupt request is accepted, or cleared to 0 in a program the above timing diagram applies to the case where the register bits are set as follows: ? the ckdir bit in the uimr register is set to "1" (external clock) ? the crd bit in the uic0 register is set to "0"(cts/rts enabled); the crs bit is set to "1" (rts selected) ? uic0 register ckpol bit is set to "0"(transmit data output at the falling edge and receive data taken in at the rising edge of the transfer clock) uic0 register txept bit sitic register ir bit even if the reception is completed, the rts does not change. the rts becomes l when the ri bit changes to 0 from 1 . (1) example of transmit timing (internal clock is selected) (2) example of receive timing (external clock is selected)
13. serial i/o page 146 9 2 3 f o 7 0 0 2 , 5 1 . b e f 0 0 . 2 . v e r 0 0 2 0 - 2 0 2 0 b 9 0 j e r ) t 6 2 / c 6 1 m , b 6 2 / c 6 1 m , a 6 2 / c 6 1 m ( p u o r g a 6 2 / c 6 1 m 13.1.1.1 counter measure for communication error occurs if a communication error occurs while transmitting or receiving in clock synchronous serial i/o mode, follow the procedures below. ? resetting the uirb register (i=0 to 2) (1) set the re bit in the uic1 register to 0 (reception disabled) (2) set the smd2 to smd0 bits in the uimr register to 000 2 (serial i/o disabled) (3) set the smd2 to smd0 bits in the uimr register to 001 2 (clock synchronous serial i/o mode) (4) set the re bit in the uic1 register to 1 (reception enabled) ? resetting the uitb register (i=0 to 2) (1) set the smd2 to smd0 bits in the uimr register to 000 2 (serial i/o disabled) (2) set the smd2 to smd0 bits in the uimr register to 001 2 (clock synchronous serial i/o mode) (3) 1 is written to re bit in the uic1 register (reception enabled), regardless to the te bit in the uic1 register. 13.1.1.2 clk polarity select function use the ckpol bit in the uic0 register (i = 0 to 2) to select the transfer clock polarity. figure 13.1.1.2.1 shows the polarity of the transfer clock. figure 13.1.1.2.1. polarity of transfer clock (2) when the ckpol bit in the uic0 register is set to "1" (transmit data output at the rising edge and the receive data taken in at the falling edge of the transfer clock ) d 1 d 2 d 3 d 4 d 5 d 6 d 7 d 1 d 2 d 3 d 4 d 5 d 6 d 7 d 0 d 0 t x d i r x d i clk i (1) when the ckpol bit in the uic0 register is set to "0" (transmit data output at the falling edge and the receive data taken in at the rising edge of the transfer clock ) d 1 d 2 d 3 d 4 d 5 d 6 d 7 d0 d 1 d 2 d 3 d 4 d 5 d 6 d 7 d 0 t x d i r x d i clk i i = 0 to 2 (2) (3) notes: 1. this applies to the case where the uform bit in the uic0 register is set to "0" (lsb first) and the uilch bit in the uic1 register is set to "0" (no reverse). 2. when not transferring, the clki pin outputs a high signal. 3. when not transferring, the clki pin outputs a low signal.
13. serial i/o page 147 9 2 3 f o 7 0 0 2 , 5 1 . b e f 0 0 . 2 . v e r 0 0 2 0 - 2 0 2 0 b 9 0 j e r ) t 6 2 / c 6 1 m , b 6 2 / c 6 1 m , a 6 2 / c 6 1 m ( p u o r g a 6 2 / c 6 1 m 13.1.1.3 lsb first/msb first select function use the uform bit in the uic0 register (i = 0 to 2) to select the transfer format. figure 13.1.1.3.1 shows the transfer format. figure 13.1.1.3.1 transfer format 13.1.1.4 continuous receive mode when the uirrm bit (i = 0 to 2) is set to "1" (continuous receive mode), the ti bit in the uic1 register is set to 0 (data present in the uitb register) by reading the uirb register. in this case, i.e., uirrm bit is set to "1", do not write dummy data to the uitb register in a program. the u0rrm and u1rrm bits are the bit 2 and bit 3 in the ucon register, respectively, and the u2rrm bit is the bit 5 in the u2c1 register. (1) when the uform bit in the uic0 register "0" (lsb first) d0 d 0 d 1 d 2 d 3 d 4 d 5 d 6 d 7 d 1 d 2 d 3 d 4 d 5 d 6 d 7 t x d i r x d i clk i (2) when the uform bit in the uic0 register is set to "1" (msb first) d 6 d 5 d 4 d 3 d 2 d 1 d 0 d 7 d 7 d 6 d 5 d 4 d 3 d 2 d 1 d 0 t x d i r x d i clk i note: 1. this applies to the case where the ckpol bit in the uic0 register is set to "0" (transmit data output at the falling edge and the receive data taken in at the rising edge of the transfer clock) and the uilch bit in the uic1 register "0" (no reverse). i = 0 to 2
13. serial i/o page 148 9 2 3 f o 7 0 0 2 , 5 1 . b e f 0 0 . 2 . v e r 0 0 2 0 - 2 0 2 0 b 9 0 j e r ) t 6 2 / c 6 1 m , b 6 2 / c 6 1 m , a 6 2 / c 6 1 m ( p u o r g a 6 2 / c 6 1 m figure 13.1.1.4.1. serial data logic switch timing d0 d1 d2 d3 d4 d5 d6 d7 transfer clock txd 2 (no reverse) h l h l txd 2 (reverse) d0 d1 d2 d3 d4 d5 d6 d7 h l (1) when the u2lch bit in the u2c1 register is set to "0" (no reverse) transfer clock h l (2) when the u2lch bit in the u2c1 register is set to "1" (reverse) note: 1. this applies to the case where the ckpol bit in the u2c0 register is set to "0" (transmit data output at the falling edge and the receive data taken in at the rising edge of the transfer clock) and the uform bit is set to "0" (lsb first). 13.1.1.6 transfer clock output from multiple pins function (uart1) the clkmd1 to clkmd0 bits in the ucon register can choose one from two transfer clock output pins. (see figure 13.1.1.6.1) this function is valid when the internal clock is selected for uart1. figure 13.1.1.6.1 transfer clock output from multiple pins 13.1.1.5 serial data logic switch function (uart2) when the u2lch bit in the u2c1 register is set to "1" (reverse), the data written to the u2tb register has its logic reversed before being transmitted. similarly, the received data has its logic reversed when read from the u2rb register. figure 13.1.1.4.1 shows serial data logic. microcomputer t x d 1 (p6 7 ) clks 1 (p6 4 ) clk 1 (p6 5 ) in clk in clk transfer enabled when the clkmd0 bit in the ucon register is set to "0" transfer enabled when the clkmd0 bit in the ucon register is set to "1" notes: 1. this applies to the case where the ckdir bit in the u1mrregister is set to "0" (internal clock) and the clkmd1 bit in the ucon register is set to "1" (transfer clock output from multiple pins). 2. this applies to the case where u1map bit in pacr register is set to 0 (p6 7 to p6 4 ).
13. serial i/o page 149 9 2 3 f o 7 0 0 2 , 5 1 . b e f 0 0 . 2 . v e r 0 0 2 0 - 2 0 2 0 b 9 0 j e r ) t 6 2 / c 6 1 m , b 6 2 / c 6 1 m , a 6 2 / c 6 1 m ( p u o r g a 6 2 / c 6 1 m _______ _______ 13.1.1.7 cts/rts separate function (uart0) _______ _______ _______ _______ this function separates cts 0 /rts 0 , outputs rts 0 from the p6 0 pin, and accepts as input the cts 0 from the p6 4 pin. to use this function, set the register bits as shown below. _______ _______ ? the crd bit in the u0c0 register is set to "0" (enables uart0 cts/rts) _______ ? the crs bit in the u0c0 register is set to "1" (outputs uart0 rts) _______ _______ ? the crd bit in the u1c0 register is set to "0" (enables uart1 cts/rts) _______ ? the crs bit in the u1c0 register is set to "0" (inputs uart1 cts) _______ ? the rcsp bit in the ucon register is set to "1" (inputs cts 0 from the p6 4 pin) ? the clkmd1 bit in the ucon register is set to "0" (clks 1 not used) _______ _______ _______ _______ note that when using the cts/rts separate function, uart1 cts/rts separate function cannot be used. figure 13.1.1.7.1. cts/rts separate function usage microcomputer t x d 0 (p6 3 ) r x d 0 (p6 2 ) in out cts rts cts 0 (p6 4 ) rts 0 (p6 0 ) ic clk 0 (p6 1 ) clk note: 1. this applies to the case where u1map bit in pacr register is set to 0 (p6 7 to p6 4 ).
13. serial i/o page 150 9 2 3 f o 7 0 0 2 , 5 1 . b e f 0 0 . 2 . v e r 0 0 2 0 - 2 0 2 0 b 9 0 j e r ) t 6 2 / c 6 1 m , b 6 2 / c 6 1 m , a 6 2 / c 6 1 m ( p u o r g a 6 2 / c 6 1 m item specification transfer data format ? character bit (transfer data): selectable from 7, 8 or 9 bits ? start bit: 1 bit ? parity bit: selectable from odd, even, or none ? stop bit: selectable from 1 or 2 bits transfer clock ? the ckdir bit in the uimr(i=0 to 2) register is set to "0" (internal clock) : fj/(16(n+1)) fj = f 1sio , f 2sio , f 8sio , f 32sio . n: setting value of uibrg register 00 16 to ff 16 ? ckdir bit is set to 1 (external clock ) : f ext /(16(n+1)) f ext : input from clki pin. n :setting value of uibrg register 00 16 to ff 16 transmission, reception control _______ _______ _______ _______ ? selectable from cts function, rts function or cts/rts function disable transmission start condition ? before transmission can start, the following requirements must be met _ the te bit in the uic1 register is set to "1" (transmission enabled) _ the ti bit in the uic1 register "0" (data present in uitb register) _______ _______ _ if cts function is selected, input l to the ctsi pin reception start condition ? before reception can start, the following requirements must be met _ the re bit in the uic1 register is set to "1" (reception enabled) _ start bit detection ? for transmission, one of the following conditions can be selected _ the uiirs bit (2) is set to "0" (transmit buffer empty): when transferring data from the uitb register to the uarti transmit register (at start of transmission) _ the uiirs bit is set to "1" (transfer completed): when the serial i/o finished sending data from the uarti transmit register ? for reception when transferring data from the uarti receive register to the uirb register (at completion of reception) error detection ? overrun error (1) this error occurs if the serial i/o started receiving the next data before reading the uirb register and received the bit one before the last stop bit of the next data ? framing error this error occurs when the number of stop bits set is not detected ? parity error this error occurs when if parity is enabled, the number of 1 s in parity and character bits does not match the number of 1 s set ? error sum flag this flag is set (= 1) when any of the overrun, framing, and parity errors is encountered select function ? lsb first, msb first selection whether to start sending/receiving data beginning with bit 0 or beginning with bit 7 can be selected ? serial data logic switch (uart2) this function reverses the logic of the transmit/receive data. the start and stop bits are not reversed. ? t x d, r x d i/o polarity switch (uart2) this function reverses the polarities of hte t x d pin output and r x d pin input. the logic levels of all i/o data is reversed. _______ _______ ? separate cts/rts pins (uart0) _________ _________ cts 0 and rts 0 are input/output from separate pins ? uart1 pin remapping selection the uart1 pin can be selected from the p6 7 to p6 4 or p7 3 to p7 0 . 13.1.2. clock asynchronous serial i/o (uart) mode the uart mode allows transmitting and receiving data after setting the desired transfer rate and transfer data format. tables 13.1.2.1 lists the specifications of the uart mode. interrupt request generation timing table 13.1.2.1. uart mode specifications notes: 1. if an overrun error occurs, bits 8 to 0 in uirb register are undefined. the ir bit in the siric register remains unchanged. 2. the u0irs and u1irs bits respectively are the bits "0" and "1" in the ucon register; the u2irs bit is the bit 4 in the u2c1 register.
13. serial i/o page 151 9 2 3 f o 7 0 0 2 , 5 1 . b e f 0 0 . 2 . v e r 0 0 2 0 - 2 0 2 0 b 9 0 j e r ) t 6 2 / c 6 1 m , b 6 2 / c 6 1 m , a 6 2 / c 6 1 m ( p u o r g a 6 2 / c 6 1 m table 13.1.2.2. registers to be used and settings in uart mode register bit function uitb 0 to 8 set transmission data (1) uirb 0 to 8 reception data can be read (1) oer,fer,per,sum error flag uibrg 0 to 7 set a transfer rate uimr smd2 to smd0 set these bits to 100 2 when transfer data is 7 bits long set these bits to 101 2 when transfer data is 8 bits long set these bits to 110 2 when transfer data is 9 bits long ckdir select the internal clock or external clock stps select the stop bit pry, prye select whether parity is included and whether odd or even iopol(i=2) (4) select the txd/rxd input/output polarity uic0 clk0, clk1 select the count source for the uibrg register crs _______ _______ select cts or rts to use txept transmit register empty flag crd _______ _______ enable or disable the cts or rts function nch select txdi pin output mode ckpol set to 0 uform lsb first or msb first can be selected when transfer data is 8 bits long. set this bit to 0 when transfer data is 7 or 9 bits long. uic1 te set this bit to 1 to enable transmission ti transmit buffer empty flag re set this bit to 1 to enable reception ri reception complete flag u2irs (2) select the source of uart2 transmit interrupt u2rrm (2) set to 0 u2lch (3) set this bit to 1 to use uart2 inverted data logic u2ere (3) set to 0 u2smr 0 to 7 set to 0 u2smr2 0 to 7 set to 0 u2smr3 0 to 7 set to 0 u2smr4 0 to 7 set to 0 ucon u0irs, u1irs select the source of uart0/uart1 transmit interrupt u0rrm, u1rrm set to 0 clkmd0 invalid because clkmd1 = 0 clkmd1 set to 0 rcsp _________ set this bit to 1 to accept as input the uart0 cts 0 signal from the p6 4 pin or p7 0 pin 7 set to 0 notes: 1. the bits used for transmit/receive data are as follows: bit 0 to bit 6 when transfer data is 7 bits long; bit 0 to bit 7 when transfer data is 8 bits long; bit 0 to bit 8 when transfer data is 9 bits long. 2. set the bit 4 to bit 5 in the u0c1 and u1c1 registers to 0 . the u0irs, u1irs, u0rrm and u1rrm bits are included in the ucon register. 3. set the bit 6 to bit 7 in the u0c1 and u1c1 registers to 0 . 4. set the bit 7 the u0mr and u1mr registers to 0 . i=0 to 2
13. serial i/o page 152 9 2 3 f o 7 0 0 2 , 5 1 . b e f 0 0 . 2 . v e r 0 0 2 0 - 2 0 2 0 b 9 0 j e r ) t 6 2 / c 6 1 m , b 6 2 / c 6 1 m , a 6 2 / c 6 1 m ( p u o r g a 6 2 / c 6 1 m table 13.1.2.3 lists the functions of the input/output pins during uart mode. table 13.1.2.4 lists the p6 4 pin functions during uart mode. note that for a period from when the uarti operation mode is selected to when transfer starts, the txdi pin outputs an h . (if the n-channel open-drain output is selected, this pin is in a high-impedance state.) table 13.1.2.3. i/o pin functions in uart mode (1) pin name function method of selection txdi (i = 0 to 2) (p6 3 , p6 7 , p7 0 ) serial data output serial data input input/output port transfer clock input input/output port (outputs "h" when performing reception only) rxdi (p6 2 , p6 6 , p7 1 ) clki (p6 1 , p6 5 , p7 2 ) set the ckdir bit in the uimr register to "0" set the ckdir bit in the uimr register to "1" set the pd6_1 bit and pd6_5 bit in the pd6 register to "0", pd7_2 bit in the pd7 register to "0" pd6_2 bit, pd6_6 bit in the pd6 register and the pd7_1 bit in the pd7 register (can be used as an input port when performing transmission only) set the crd bit in the uic0 register to "0" set the crs bit in the uic0 register to "0" set the pd6_0 bit and pd6_4 bit in the pd6 register to "0", the pd7_3 bit in the pd7 register "0" set the crd bit in the uic0 register to "0" set the crs bit in the uic0 register to "1" set the crd bit in the uic0 register "1" cts input rts output ctsi/rtsi (p6 0 , p6 4 , p7 3 ) note: 1. when the u1map bit in pacr register is set to 1 (p7 3 to p7 0 ), uart1 pin is assgined to p7 3 to p7 0 . table 13.1.2.4. p6 4 pin functions in uart mode (1) pin function bit set value u1c0 register ucon register pd6 register crd crs rcsp clkmd1 pd6_4 p6 4 1 0 0 input: 0, output: 1 cts 1 0000 rts 1 10 0 cts 0 (2) 0 0 0 00 10 notes: 1. when the u1map bit in pacr register is 1 (p7 3 to p7 0 ), this table lists the p7 0 functions. 2. in addition to this, set the crd bit in the u0c0 register to 0 (cts 0 /rts 0 enabled) and the crs bit in the u0c0 register to 1 (rts 0 selected).
13. serial i/o page 153 9 2 3 f o 7 0 0 2 , 5 1 . b e f 0 0 . 2 . v e r 0 0 2 0 - 2 0 2 0 b 9 0 j e r ) t 6 2 / c 6 1 m , b 6 2 / c 6 1 m , a 6 2 / c 6 1 m ( p u o r g a 6 2 / c 6 1 m figure 13.1.2.1. typical transmit timing in uart mode (uart0, uart1) start bit parity bit txdi ctsi 1 0 1 l h 0 1 tc = 16 (n + 1) / fj or 16 (n + 1) / f ext fj : frequency of uibrg count source (f 1sio , f 2sio , f 8sio , f 32sio ) f ext : frequency of uibrg count source (external clock) n : value set to uibrg i: 0 to 2 0 1 txdi 0 1 0 1 0 1 transfer clock tc 0 1 tc transfer clock d 0 d 1 d 2 d 3 d 4 d 5 d 6 d 7 st p d 0 d 1 d 2 d 3 d 4 d 5 d 6 d 7 sp st p sp d 0 d 1 st stop bit start bit the transfer clock stops momentarily as ctsi is h when the stop bit is checked. the transfer clock starts as the transfer starts immediately ctsi changes to l . d 0 d 1 d 2 d 3 d 4 d 5 d 6 d 7 st sp d 8 d 0 d 1 d 2 d 3 d 4 d 5 d 6 d 7 st d 8 d 0 d 1 st sp sp stop bit stop bit 0 sp stopped pulsing because the te bit = 0 write data to the uitb register uic1 register te bit uic1 register ti bit uic0 register txept bit sitic register ir bit transferred from uitb register to uarti transmit register the above timing diagram applies to the case where the register bits are set as follows: ? set the prye bit in the uimr register to "1" (parity enabled) ? set the stps bit in the uimr register to "0" (1 stop bit) ? set the crd bit in the uic0 register to "0" (cts/rts enabled), the crs bit to "0" (cts selected) ? set the uiirs bit to "1" (an interrupt request occurs when transmit completed): u0irs bit is the ucon register bit 0, u1irs bit is the ucon register bit 1, and u2irs bit is the u2c1 register bit 4 cleared to 0 when interrupt request is accepted, or cleared to 0 in a program uic1 register te bit uic1 register ti bit uic0 register txept bit sitic register ir bit cleared to 0 when interrupt request is accepted, or cleared to 0 in a program write data to the uitb register transferred from uitb register to uarti transmit register tc = 16 (n + 1) / fj or 16 (n + 1) / f ext fj : frequency of uibrg count source (f 1sio , f 2sio , f 8sio , f 32sio ) f ext : frequency of uibrg count source (external clock) n : value set to uibrg i: 0 to 2 the above timing diagram applies to the case where the register bits are set as follows: ? set the prye bit in the uimr register to "0" (parity disabled) ? set the stps bit in the uimr register to "1" (2 stop bits) ? set the crd bit in the uic0 register to "1"(cts/rts disabled) ? set the uiirs bit to "0" (an interrupt request occurs when transmit buffer becomes empty): u0irs bit is the ucon register bit 0, u1irs bit is the ucon register bit 1, and u2irs bit is the u2c1 register bit 4 ? example of transmit timing when transfer data is 8 bits long (parity enabled, one stop bit) ? example of transmit timing when transfer data is 9 bits long (parity disabled, two stop bits)
13. serial i/o page 154 9 2 3 f o 7 0 0 2 , 5 1 . b e f 0 0 . 2 . v e r 0 0 2 0 - 2 0 2 0 b 9 0 j e r ) t 6 2 / c 6 1 m , b 6 2 / c 6 1 m , a 6 2 / c 6 1 m ( p u o r g a 6 2 / c 6 1 m ? example of receive timing when transfer data is 8 bits long (parity disabled, one stop bit) figure 13.1.2.2. receive operation 13.1.2.1. bit rates in uart mode, the frequency set by the uibrg register (i=0 to 2) divided by 16 become the bit rates. table 13.1.2.1.1 lists example of bit rate and settings. table 13.1.2.1.1 example of bit rates and settings bit rate count source peripheral function clock : 16mhz peripheral function clock : 20mhz (bps) of brg set value of brg : n actual time (bps) set value of brg : n actual time (bps) 1200 f8 103(67h) 1202 129(81h) 1202 2400 f8 51(33h) 2404 64(40h) 2404 4800 f8 25(19h) 4808 32(20h) 4735 9600 f1 103(67h) 9615 129(81h) 9615 14400 f1 68(44h) 14493 86(56h) 14368 19200 f1 51(33h) 19231 64(40h) 19231 28800 f1 34(22h) 28571 42(2ah) 29070 31250 f1 31(1fh) 31250 39(27h) 31250 38400 f1 25(19h) 38462 32(20h) 37879 51200 f1 19(13h) 50000 24(18h) 50000 d 0 start bit sampled l uibrg count source rxdi transfer clock rtsi stop bit 1 0 0 1 h l 0 1 reception triggered when transfer clock is generated by falling edge of start bit uic1 register re bit uic1 register ri bit siric register ir bit cleared to 0 when interrupt request is accepted, or cleared to 0 by program receive data taken in d 7 d 1 transferred from uarti receive register to uirb register the above timing diagram applies to the case where the register bits are set as follows: ? set the prye bit in the uimr register to "0"(parity disabled) ? set the stps bit in the uimr register to "0" (1 stop bit) ? set the crd bit in the uic0 register to "0" (ctsi/rtsi enabled), the crs bit to "1" (rtsi selected) i = 0 to 2 read out from uirb register
13. serial i/o page 155 9 2 3 f o 7 0 0 2 , 5 1 . b e f 0 0 . 2 . v e r 0 0 2 0 - 2 0 2 0 b 9 0 j e r ) t 6 2 / c 6 1 m , b 6 2 / c 6 1 m , a 6 2 / c 6 1 m ( p u o r g a 6 2 / c 6 1 m figure 13.1.2.3.1. transfer format (1) when the uform bit in the uic0 register is set to "0" (lsb first) (2) when the uform bit in the uic0 register "1" (msb first) d 1 d 2 d 3 d 4 d 5 d 6 sp d0 d 1 d 2 d 3 d 4 d 5 d 6 sp d 0 t x d i r x d i clk i d 6 d 5 d 4 d 3 d 2 d 1 d 0 d 7 t x d i r x d i clk i st st d 7 p d 7 p sp sp st st p p d 6 d 5 d 4 d 3 d 2 d 1 d 0 d 7 note: 1. this applies to the case where the ckpol bit in the uic0 register is set to "0" (transmit data output at the falling edge and the receive data taken in at the rising edge of the transfer clock), the uilch bit in the uic1 register is set to "0" (no reverse), the stps bit in the uimr register is set to "0" (1 stop bit) and the prye bit in the uimr register is set to "1" (parity enabled). i = 0 to 2 st: start bit p: parity bit sp: stop bit 13.1.2.2. counter measure for communication error if a communication error occurs while transmitting or receiving in uart mode, follow the procedure below. ? resetting the uirb register (i=0 to 2) (1) set the re bit in the uic1 register to 0 (reception disabled) (2) set the re bit in the uic1 register to 1 (reception enabled) ? resetting the uitb register (i=0 to 2) (1) set the smd2 to smd0 bits in uimr register 000 2 (serial i/o disabled) (2) set the smd2 to smd0 bits in uimr register 001 2 , 101 2 , 110 2 (3) 1 is written to re bit in the uic1 register (reception enabled), regardless of the te bit in the uic1 register 13.1.2.3. lsb first/msb first select function as shown in figure 14.1.2.3.1, use the uform bit in the uic0 register to select the transfer format. this function is valid when transfer data is 8 bits long.
13. serial i/o page 156 9 2 3 f o 7 0 0 2 , 5 1 . b e f 0 0 . 2 . v e r 0 0 2 0 - 2 0 2 0 b 9 0 j e r ) t 6 2 / c 6 1 m , b 6 2 / c 6 1 m , a 6 2 / c 6 1 m ( p u o r g a 6 2 / c 6 1 m 13.1.2.5. txd and rxd i/o polarity inverse function (uart2) this function inverses the polarities of the t x d2 pin output and r x d2 pin input. the logic levels of all input/output data (including the start, stop and parity bits) are inversed. figure 13.1.2.5.1 shows the t x d pin output and r x d pin input polarity inverse. figure 13.1.2.5.1. t x d and r x d i/o polarity inverse 13.1.2.4. serial data logic switching function (uart2) the data written to the u2tb register has its logic reversed before being transmitted. similarly, the received data has its logic reversed when read from the u2rb register. figure 13.1.2.4.1 shows serial data logic. figure 13.1.2.4.1. serial data logic switching transfer clock h l d0 d1 d2 d3 d4 d5 d6 d7 psp st txd 2 (no reverse) h l txd 2 (reverse) sp st d3 d4 d5 d6 d7 p d0 d1 d2 h l (1) when the u2lch bit in the u2c1 register is set to "0" (no reverse) (2) when the u2lch bit in the u2c1 register is set "1" (reverse) transfer clock h l note: 1. this applies to the case where the ckpol bit in the u2c0 register is set to "0" (transmit data output at the falling edge of the transfer clock), the uform bit in the u2c0 register is set to "0" (lsb first), the stps bit in the u2mr register is set to "0" (1 stop bit) and the prye bit in the u2mr register is set to "1" (parity enabled). st: start bit p: parity bit sp: stop bit (1) when the iopol bit in the u2mr register is set to "0" (no reverse) (2) when the iopol bit in the u2mr register is set to "1" (reverse) d0 d1 d2 d3 d4 d5 d6 d7 psp st sp st d3 d4 d5 d6 d7 p d0 d1 d2 d0 d1 d2 d3 d4 d5 d6 d7 psp st h sp st d3 d4 d5 d6 d7 p d0 d1 d2 transfer clock txd 2 (no reverse) rxd 2 (no reverse) transfer clock txd 2 (reverse) rxd 2 (reverse) l h l h l h l h l h l note: 1. this applies to the case where the uform bit in the u2c0 register is set to "0"(lsb first), the stps bit in the u2mr register is set to "0" (1 stop bit) and the prye bit in the u2mr register is set to "1"(parity enabled). st: start bit p: parity bit sp: stop bit
13. serial i/o page 157 9 2 3 f o 7 0 0 2 , 5 1 . b e f 0 0 . 2 . v e r 0 0 2 0 - 2 0 2 0 b 9 0 j e r ) t 6 2 / c 6 1 m , b 6 2 / c 6 1 m , a 6 2 / c 6 1 m ( p u o r g a 6 2 / c 6 1 m _______ _______ 13.1.2.6. cts/rts separate function (uart0) _______ _______ _______ _______ this function separates cts 0 /rts 0 , outputs rts 0 from the p6 0 pin, and accepts as input the cts 0 from the p6 4 pin. to use this function, set the register bits as shown below. _______ _______ ? set the crd bit in the u0c0 register to "0" (enables uart0 cts/rts) _______ ? set the crs bit in the u0c0 register to "1"(outputs uart0 rts) _______ _______ ? set the crd bit in the u1c0 register to "0" (enables uart1 cts/rts) _______ ? set the crs bit in the u1c0 register to "0" (inputs uart1 cts) _______ ? set the rcsp bit in the ucon register to "1" (inputs cts 0 from the p6 4 pin) ? set the clkmd1 bit in the ucon register to "0" (clks 1 not used) _______ _______ _______ _______ note that when using the cts/rts separate function, uart1 cts/rts separate function cannot be used. _______ _______ figure 13.1.2.6.1. cts/rts separate function microcomputer t x d 0 (p6 3 ) r x d 0 (p6 2 ) in out cts rts cts 0 (p6 4 ) rts 0 (p6 0 ) ic note: 1. this applies to the case where u1map bit in pacr register is set to 0 (p6 7 to p6 4 ).
13. serial i/o page 158 9 2 3 f o 7 0 0 2 , 5 1 . b e f 0 0 . 2 . v e r 0 0 2 0 - 2 0 2 0 b 9 0 j e r ) t 6 2 / c 6 1 m , b 6 2 / c 6 1 m , a 6 2 / c 6 1 m ( p u o r g a 6 2 / c 6 1 m 13.1.3 special mode 1 (i 2 c bus mode)(uart2) i 2 c bus mode is provided for use as a simplified i 2 c bus interface compatible mode. table 13.1.3.1 lists the specifications of the i 2 c bus mode. table 13.1.3.2 and 13.1.3.3 list the registers used in the i 2 c bus mode and the register values set. table 13.1.3.4 lists the i 2 c bus mode fuctions. figure 13.1.3.1 shows the block diagram for i 2 c bus mode. figure 13.1.3.2 shows scl 2 timing. as shown in table 13.1.3.2, the microcomputer is placed in i 2 c bus mode by setting the smd2 to smd0 bits to 010 2 and the iicm bit to 1 . because sda 2 transmit output has a delay circuit attached, sda output does not change state until scl 2 goes low and remains stably low. table 13.1.3.1. i 2 c bus mode specifications item specification transfer data format ? transfer data length: 8 bits transfer clock ? during master the ckdir bit in the u2mr register is set to 0 (internal clock) : fj/ (2(n+1)) fj = f 1sio , f 2sio , f 8sio , f 32sio . n: setting value in the u2brg register 00 16 to ff 16 ? during slave the ckdir bit is set to 1 (external clock) : input from scl 2 pin transmission start condition ? before transmission can start, the following requirements must be met (1) _ the te bit in the u2c1 register is set to "1" (transmission enabled) _ the ti bit in the u2c1 register is set to "0" (data present in u2tb register) reception start condition ? before reception can start, the following requirements must be met (1) _ the re bit in the u2c1 register is set to "1" (reception enabled) _ the te bit in the u2c1 register is set to "1" (transmission enabled) _ the ti bit in the u2c1 register is set to "0" (data present in the uitb register) when start or stop condition is detected, acknowledge undetected, and acknowledge detected error detection ? overrun error (2) this error occurs if the serial i/o started receiving the next data before reading the u2rb register and received the 8th bit of the next data select function ? arbitration lost timing at which the abt bit in the u2rb register is updated can be selected ? sda2 digital delay no digital delay or a delay of 2 to 8 u2brg count source clock cycles selectable ? clock phase setting with or without clock delay selectable interrupt request generation timing notes: 1. when an external clock is selected, the conditions must be met while the external clock is in the high state. 2. if an overrun error occurs, bits 8 to 0 in uirb register are undefined. the ir bit in the siric register remains unchanged.
13. serial i/o page 159 9 2 3 f o 7 0 0 2 , 5 1 . b e f 0 0 . 2 . v e r 0 0 2 0 - 2 0 2 0 b 9 0 j e r ) t 6 2 / c 6 1 m , b 6 2 / c 6 1 m , a 6 2 / c 6 1 m ( p u o r g a 6 2 / c 6 1 m clk control falling edge detection external clock internal clock start/stop condition detection interrupt request start condition detection stop condition detection reception register bus busy transmission register arbitration noise filter sda2 scl2 uart2 d t q d t q d t q nack ack uart2 uart2 uart2 r uart2 transmit, nack interrupt request uart2 receive, ack interrupt request, dma1 request iicm=1 and iicm2=0 s r q als r s swc iicm=1 and iicm2=0 iicm2=1 iicm2= 1 swc2 sdh i dma0, dma1 request noise filter iicm : bit in the u2smr iicm2, swc, als, swc2, sdhi : bits in the u2smr2 stspsel, ackd, ackc : bits in the u2smr4 iicm=0 iicm=1 dma 0 stspsel=0 stspsel=1 stspsel=1 stspsel=0 sda stsp scl stsp ackc=1 ackc=0 q port register (1) i/o port 9th bit falling edge 9th bit ackd bit delay circuit this diagram applies to the case where the smd2 to smd0 bits in the the u2mr register is set to "010 2 " and the iicm bit in the u2smr register is set to "1". note: 1. if the iicm bit is set to "1", the pin can be read even when the pd7_1 bit is set to "1" (output mode). start and stop condition generation block figure 13.1.3.1. i 2 c bus mode block diagram
13. serial i/o page 160 9 2 3 f o 7 0 0 2 , 5 1 . b e f 0 0 . 2 . v e r 0 0 2 0 - 2 0 2 0 b 9 0 j e r ) t 6 2 / c 6 1 m , b 6 2 / c 6 1 m , a 6 2 / c 6 1 m ( p u o r g a 6 2 / c 6 1 m table 13.1.3.2. registers to be used and settings in i 2 c bus mode (1) (continued) register bit function master slave u2tb 0 to 7 set transmission data set transmission data (1) u2rb 0 to 7 reception data can be read reception data can be read (1) 8 ack or nack is set in this bit ack or nack is set in this bit abt arbitration lost detection flag invalid oer overrun error flag overrun error flag u2brg 0 to 7 set a transfer rate invalid u2mr smd2 to smd0 set to 010 2 set to 010 2 (1) ckdir set to 0 set to 1 iopol set to 0 set to 0 u2c0 clk1, clk0 select the count source for the u2brg invalid register crs invalid because crd = 1 invalid because crd = 1 txept transmit buffer empty flag transmit buffer empty flag crd set to 1 set to 1 nch set to 1 set to 1 ckpol set to 0 set to 0 uform set to 1 set to 1 u2c1 te set this bit to 1 to enable transmission set this bit to 1 to enable transmission ti transmit buffer empty flag transmit buffer empty flag re set this bit to 1 to enable reception set this bit to 1 to enable reception ri reception complete flag reception complete flag u2irs invalid invalid u2rrm, set to 0 set to 0 u2lch, u2ere u2smr iicm set to 1 set to 1 abc select the timing at which arbitration-lost invalid is detected bbs bus busy flag bus busy flag 3 to 7 set to 0 set to 0 u2smr2 iicm2 refer to table 13.1.3.4 i 2 c bus mode functions refer to table 13.1.3.4 i 2 c bus mode functions csc set this bit to 1 to enable clock set to 0 synchronization swc set this bit to 1 to have scl 2 output set this bit to 1 to have scl 2 output fixed to l at the falling edge of the 9th fixed to l at the falling edge of the 9 th bit of clock bit of clock als set this bit to 1 to have sda 2 output set to 0 stopped when arbitration-lost is detected stac set to 0 set this bit to 1 to initialize uart2 at start condition detection swc2 set this bit to 1 to have scl 2 output set this bit to 1 to have scl 2 output forcibly pulled low forcibly pulled low sdhi set this bit to 1 to disable sda 2 output set this bit to 1 to disable sda 2 output 7 set to 0 set to 0 u2smr3 0, 2, 4 and nodc set to 0 set to 0 ckph refer to table 13.1.3.4 i 2 c bus mode functions refer to table 13.1.3.4 i 2 c bus mode functions dl2 to dl0 set the amount of sda 2 digital delay set the amount of sda 2 digital delay note: 1. not all register bits are described above. set those bits to 0 when writing to the registers in i 2 c bus mode.
13. serial i/o page 161 9 2 3 f o 7 0 0 2 , 5 1 . b e f 0 0 . 2 . v e r 0 0 2 0 - 2 0 2 0 b 9 0 j e r ) t 6 2 / c 6 1 m , b 6 2 / c 6 1 m , a 6 2 / c 6 1 m ( p u o r g a 6 2 / c 6 1 m u2smr4 stareq set this bit to 1 to generate start set to 0 condition rstareq set this bit to 1 to generate restart set to 0 condition stpreq set this bit to 1 to generate stop set to 0 condition stspsel set this bit to 1 to output each condition set to 0 ackd select ack or nack select ack or nack ackc set this bit to 1 to output ack data set this bit to 1 to output ack data sclhi set this bit to 1 to have scl 2 output set to 0 stopped when stop condition is detected swc9 set to 0 set this bit to 1 to set the scl 2 to l hold at the falling edge of the 9th bit of clock register bit function master slave table 13.1.3.3. registers to be used and settings in i 2 c bus mode (2) (continued) note: 1. not all bits in the register are described above. set those bits to 0 when writing to the registers in i 2 c bus mode.
13. serial i/o page 162 9 2 3 f o 7 0 0 2 , 5 1 . b e f 0 0 . 2 . v e r 0 0 2 0 - 2 0 2 0 b 9 0 j e r ) t 6 2 / c 6 1 m , b 6 2 / c 6 1 m , a 6 2 / c 6 1 m ( p u o r g a 6 2 / c 6 1 m function i 2 c bus mode (smd2 to smd0 = 010 2 , iicm = 1) clock synchronous serial i/o mode (smd2 to smd0 = 001 2 , iicm = 0) factor of interrupt number 15 (1) (refer to fig.13.1.3.2 .) no acknowledgment detection (nack) rising edge of scl 2 9th bit factor of interrupt number 16 (1) 1(refer to fig.13.1.3.2 .) start condition detection or stop condition detection (refer to figure 13.1.3.2.1. stspsel bit function ) uart2 transmission output delay functions of p7 0 pin noise filter width read rxd2 and scl 2 pin levels factor of interrupt number 10 (1) (refer to fig.13.1.3.2 .) acknowledgment detection (ack) rising edge of scl 2 9th bit initial value of txd2 and sda 2 outputs uart2 transmission transmission started or completed (selected by u2irs) uart2 reception when 8th bit received ckpol = 0 (rising edge) ckpol = 1 (falling edge) not delayed txd2 output rxd2 input clk2 input or output selected 15ns possible when the corresponding port direction bit = 0 ckpol = 0 (h) ckpol = 1 (l) delayed sda 2 input/output scl 2 input/output (cannot be used in i 2 c mode) initial and end values of scl 2 h 200ns always possible no matter how the corresponding port direction bit is set the value set in the port register before setting i 2 c bus mode (2) timing for transferring data from the uart reception shift register to the u2rb registe r iicm2 = 0 (nack/ack interrupt) iicm2 = 1 (uart transmit/ receive interrupt) ckph = 1 (clock delay) ckph = 1 (clock delay) uart2 transmission rising edge of scl 2 9th bit uart2 transmission falling edge of scl 2 next to the 9th bit uart2 transmission falling edge of scl 2 9th bit ckpol = 0 (rising edge) ckpol = 1 (falling edge) rising edge of scl 2 9th bit falling edge of scl 2 9th bit falling and rising edges of scl 2 9th bit dma1 factor (refer to fig. 14.1.3.2. ) uart2 reception acknowledgment detection (ack) uart2 reception falling edge of scl 2 9th bi t store received data 1st to 8th bits are stored in u2rb register bit 0 to bit 7 1st to 8th bits are stored in u2rb register bit 7 to bit 0 1st to 7th bits are stored in u2rb register bit 6 to bit 0, with 8th bit stored in u2rb register bit 8 l read u2rb register bit 6 to bit 0 as bit 7 to bit 1, and bit 8 as bit 0 (4) read received data u2rb register status is read directly as is ckph = 0 (no clock delay) ckph = 0 (no clock delay) h l 1st to 8th bits are stored in u2rb register bit 7 to bit 0 (3) functions of p7 1 pin functions of p7 2 pin notes: 1. if the source or cause of any interrupt is changed, the ir bit in the interrupt control register for the changed interrupt may inadvertently be set to 1 (interrupt requested). (refer to notes on interrupts in usage notes) if one of the bits shown below is changed, the interrupt source, the interrupt timing, etc. change. therefore, always be sure to clear the ir bit to 0 (interrupt not requested) after changing those bits. smd2 to smd0 bits in the u2mr register, iicm bit in the u2smr register, iicm2 bit in the u2smr2 register, ckph bit in the u2smr3 register 2. set the initial value of sda 2 output while the smd2 to smd0 bits in the u2mr register is set to 000 2 (serial i/o disabled). 3. second data transfer to u2rb register (rising edge of scl 2 9th bit) 4. first data transfer to u2rb register (falling edge of scl 2 9th bit) table 13.1.3.4. i 2 c bus mode functions
13. serial i/o page 163 9 2 3 f o 7 0 0 2 , 5 1 . b e f 0 0 . 2 . v e r 0 0 2 0 - 2 0 2 0 b 9 0 j e r ) t 6 2 / c 6 1 m , b 6 2 / c 6 1 m , a 6 2 / c 6 1 m ( p u o r g a 6 2 / c 6 1 m figure 13.1.3.2. transfer to u2rb register and interrupt timing (4) when the iicm2 bit is set to "1" and the ckph bit is set to "1" (3) when the iicm2 bit is set to "1" (uart transmit or receive interrupt) and the ckph bit is set to "0" sda2 scl2 receive interrupt (dma request) transmit interrupt sda2 scl2 the above timing applies to the following setting : ? the ckdir bit in the u2mr register is set to "1" (slave) (1) when the iicm2 bit is set to "0" (ack or nack interrupt) and the ckph bit is set to "0" (no clock delay) d 6 d 5 d 4 d 3 d 2 d 1 d 8 (ack or nack) d 7 sda2 scl2 d 0 ack interrupt (dma request) or nack interrupt (2) when the iicm2 bit is set to "0" and the ckph bit is set to "1" (clock delay) sda2 scl2 1st bit 2nd bit 3rd bit 4th bit 5th bit 6th bit 7th bit 8th bit 9th bit b15 ??? b9 b8 b7 b0 d 8 contents of the u2rb register b15 ??? b9 b8 b7 b0 b15 ??? b9 b8 b7 b0 b15 ??? b9 b8 b7 b0 b15 ??? b9 b8 b7 b0 d 7 d 6 d 5 d 4 d 3 d 2 d 1 d 0 d 6 d 5 d 4 d 3 d 2 d 1 d 7 d 0 ack interrupt (dma request) or nack interrupt d 8 d 7 d 6 d 5 d 4 d 3 d 2 d 1 d 0 d 6 d 5 d 4 d 3 d 2 d 1 d 7 d 0 d 7 d 6 d 5 d 4 d 3 d 2 d 1 d 0 d 6 d 5 d 4 d 3 d 2 d 1 d 7 d 0 d 7 d 6 d 5 d 4 d 3 d 2 d 1 d 0 d 8 d 7 d 6 d 5 d 4 d 3 d 2 d 1 d 0 d 8 (ack or nack) 1st bit 2nd bit 3rd bit 4th bit 5th bit 6th bit 7th bit 8th bit 9th bit d 8 (ack or nack) 1st bit 2nd bit 3rd bit 4th bit 5th bit 6th bit 7th bit 8th bit 9th bit d 8 (ack or nack) 1st bit 2nd bit 3rd bit 4th bit 5th bit 6th bit 7th bit 8th bit 9th bit data is transferred to the u2rb register data is transferred to the u2rb register data is transferred to the u2rb register receive interrupt (dma request) transmit interrupt data is transferred to the u2rb register data is transferred to the u2rb register contents of the u2rb register contents of the u2rb register contents of the u2rb register contents of the u2rb register
13. serial i/o page 164 9 2 3 f o 7 0 0 2 , 5 1 . b e f 0 0 . 2 . v e r 0 0 2 0 - 2 0 2 0 b 9 0 j e r ) t 6 2 / c 6 1 m , b 6 2 / c 6 1 m , a 6 2 / c 6 1 m ( p u o r g a 6 2 / c 6 1 m 13.1.3.1 detection of start and stop condition whether a start or a stop condition has been detected is determined. a start condition-detected interrupt request is generated when the sda 2 pin changes state from high to low while the scl 2 pin is in the high state. a stop condition-detected interrupt request is generated when the sda 2 pin changes state from low to high while the scl 2 pin is in the high state. because the start and stop condition-detected interrupts share the interrupt control register and vec- tor, check the bbs bit in the u2smr register to determine which interrupt source is requesting the interrupt. setup time hold time scl2 sda2 (start condition) sda2 (stop condition) 3 to 6 cycles < setup time (1) 3 to 6 cycles < hold time (1) note: 1. when the pclk1 bit in the pclkr register is set to "1", the cycles indicates the f1sio's generation frequency cycles; when pclk1 bit is set to "0", the cycles indicated the f2sio's generation frequency cycles. figure 13.1.3.1.1. detection of start and stop condition 13.1.3.2 output of start and stop condition a start condition is generated by setting the stareq bit in the u2smr4 register to 1 (start). a restart condition is generated by setting the rstareq bit in the u2smr4 register to 1 (start). a stop condition is generated by setting the stpreq bit in the u2smr4 register to 1 (start). the output procedure is described below. (1) set the stareq bit, rstareq bit or stpreq bit to 1 (start). (2) set the stspsel bit in the u2smr4 register to 1 (output). make sure that no interrupts or dma transfers will occur between (1) and (2). the function of the stspsel bit is shown in table 13.1.3.2.1 and figure 13.1.3.2.1.
13. serial i/o page 165 9 2 3 f o 7 0 0 2 , 5 1 . b e f 0 0 . 2 . v e r 0 0 2 0 - 2 0 2 0 b 9 0 j e r ) t 6 2 / c 6 1 m , b 6 2 / c 6 1 m , a 6 2 / c 6 1 m ( p u o r g a 6 2 / c 6 1 m table 13.1.3.2.1. stspsel bit functions figure 13.1.3.2.1. stspsel bit functions function output of scl2 and sda2 pins start/stop condition interrupt request generation timing stspsel = 0 output transfer clock and data/ program with a port determines how the start condition or stop condition is output start/stop condition are de- tected stspsel = 1 the stareq, rstareq and stpreq bit determine how the start condition or stop condition is output start/stop condition generation are completed sda2 start condition detection interrupt stop condition detection interrupt (1) in slave mode, ckdir is set to "1" (external clock) scl 2 sda2 start condition detection interrupt stop condition detection interrupt (2) in master mode, ckdir is set to "0" (internal clock), ckph is set to "1"(clock delayed) scl 2 set stpreq to "1" (start) stpsel bit 0 stpsel bit set to "1" by a program set to "0" by a program set to "1" by a program set to "0" by a program 1st 2nd 3rd 5th 6th 7th 8th 9th bit 4th set stareq to "1" (start) 1st 2nd 3rd 5th 6th 7th 8th 9th bit 4th 13.1.3.3 arbitration unmatching of the transmit data and sda 2 pin input data is checked synchronously with the rising edge of scl 2 . use the abc bit in the u2smr register to select the timing at which the abt bit in the u2rb register is updated. if the abc bit is set to "0" (updated bitwise), the abt bit is set to 1 at the same time unmatching is detected during check, and is cleared to 0 when not detected. in cases when the abc bit is set to 1 , if unmatching is detected even once during check, the abt bit is set to 1 (unmatching detected) at the falling edge of the clock pulse of 9th bit. if the abt bit needs to be updated bytewise, clear the abt bit to 0 (undetected) after detecting acknowledge in the first byte, before transferring the next byte. setting the als bit in the u2smr2 register to 1 (sda output stop enabled) causes arbitration-lost to occur, in which case the sda 2 pin is placed in the high-impedance state at the same time the abt bit is set to 1 (unmatching detected).
13. serial i/o page 166 9 2 3 f o 7 0 0 2 , 5 1 . b e f 0 0 . 2 . v e r 0 0 2 0 - 2 0 2 0 b 9 0 j e r ) t 6 2 / c 6 1 m , b 6 2 / c 6 1 m , a 6 2 / c 6 1 m ( p u o r g a 6 2 / c 6 1 m 13.1.3.4 transfer clock data is transmitted/received using a transfer clock like the one shown in figure 13.1.3.2.1. the csc bit in the u2smr2 register is used to synchronize the internally generated clock (internal scl2) and an external clock supplied to the scl 2 pin. in cases when the csc bit is set to 1 (clock synchronization enabled), if a falling edge on the scl 2 pin is detected while the internal scl 2 is high, the internal scl 2 goes low, at which time the u2brg register value is reloaded with and starts count- ing in the low-level interval. if the internal scl 2 changes state from low to high while the scl 2 pin is low, counting stops, and when the scl 2 pin goes high, counting restarts. in this way, the uart2 transfer clock is comprised of the logical product of the internal scl 2 and scl 2 pin signal. the transfer clock works from a half period before the falling edge of the internal scl 2 1st bit to the rising edge of the 9 th bit. to use this function, select an internal clock for the transfer clock. the swc bit in the u2smr2 register allows to select whether the scl 2 pin should be fixed to or freed from low-level output at the falling edge of the 9th clock pulse. if the sclhi bit in the u2smr4 register is set to 1 (enabled), scl 2 output is turned off (placed in the high-impedance state) when a stop condition is detected. setting the swc2 bit in the u2smr2 register is set to "1" (0 output) makes it possible to forcibly output a low-level signal from the scl 2 pin even while sending or receiving data. clearing the swc2 bit to 0 (transfer clock) allows the transfer clock to be output from or supplied to the scl 2 pin, instead of outputting a low-level signal. if the swc9 bit in the u2smr4 register is set to 1 (scl hold low enabled) when the ckph bit in the u2smr3 register is set to "1", the scl 2 pin is fixed to low-level output at the falling edge of the clock pulse next to the ninth. setting the swc9 bit is set to "0" (scl hold low disabled) frees the scl 2 pin from low-level output. 13.1.3.5 sda output the data written to the bit 7 to bit 0 (d 7 to d 0 ) in the u2tb register is sequentially output beginning with d 7 . the ninth bit (d 8 ) is ack or nack. the initial value of sda 2 transmit output can only be set when iicm is set to "1" (i 2 c bus mode) and the smd2 to smd0 bits in the the u2mr register are set to 000 2 (serial i/o disabled). the dl2 to dl0 bits in the u2smr3 register allow to add no delays or a delay of 2 to 8 u2brg count source clock cycles to sda 2 output. setting the sdhi bit in the u2smr2 register is set to "1" (sda output disabled) forcibly places the sda 2 pin in the high-impedance state. do not write to the sdhi bit synchronously with the rising edge of the uart2 transfer clock. this is because the abt bit may inadvertently be set to 1 (detected). 13.1.3.6 sda input when the iicm2 bit is set to "0", the 1st to 8th bits (d 7 to d 0 ) of received data are stored in the bit 7 to bit 0 in the u2rb register. the 9th bit (d 8 ) is ack or nack. when the iicm2 bit is set to "1", the 1st to 7th bits (d 7 to d 1 ) of received data are stored in the bit 6 to bit 0 in the u2rb register and the 8th bit (d 0 ) is stored in the bit 8 in the u2rb register. even when the iicm2 bit is set to "1", providing the ckph bit to "1", the same data as when the iicm2 bit is set to "0" can be read out by reading the u2rb register after the rising edge of the corresponding clock pulse of 9th bit.
13. serial i/o page 167 9 2 3 f o 7 0 0 2 , 5 1 . b e f 0 0 . 2 . v e r 0 0 2 0 - 2 0 2 0 b 9 0 j e r ) t 6 2 / c 6 1 m , b 6 2 / c 6 1 m , a 6 2 / c 6 1 m ( p u o r g a 6 2 / c 6 1 m 13.1.3.7 ack and nack if the stspsel bit in the u2smr4 register is set to 0 (start and stop conditions not generated) and the ackc bit in the u2smr4 register is set to 1 (ack data output), the value of the ackd bit in the u2smr4 register is output from the sda 2 pin. if the iicm2 bit is set to "0", a nack interrupt request is generated if the sda 2 pin remains high at the rising edge of the 9th bit of transmit clock pulse. an ack interrupt request is generated if the sda 2 pin is low at the rising edge of the 9th bit of transmit clock pulse. if ack2 is selected for the cause of dma1 request, a dma transfer can be activated by detection of an acknowledge. 13.1.3.8 initialization of transmission/reception if a start condition is detected while the stac bit is set to "1" (uart2 initialization enabled), the serial i/o operates as described below. - the transmit shift register is initialized, and the content of the u2tb register is transferred to the transmit shift register. in this way, the serial i/o starts sending data synchronously with the next clock pulse applied. however, the uart2 output value does not change state and remains the same as when a start condition was detected until the first bit of data is output synchronously with the input clock. - the receive shift register is initialized, and the serial i/o starts receiving data synchronously with the next clock pulse applied. - the swc bit is set to 1 (scl wait output enabled). consequently, the scl 2 pin is pulled low at the falling edge of the ninth clock pulse. note that when uart2 transmission/reception is started using this function, the ti does not change state. note also that when using this function, the selected transfer clock should be an external clock.
13. serial i/o page 168 ) t 6 2 / c 6 1 m , b 6 2 / c 6 1 m , a 6 2 / c 6 1 m ( p u o r g a 6 2 / c 6 1 m 9 2 3 f o 7 0 0 2 , 5 1 . b e f 0 0 . 2 . v e r 0 0 2 0 - 2 0 2 0 b 9 0 j e r 13.1.4 special mode 2 (uart2) multiple slaves can be serially communicated from one master. transfer clock polarity and phase are selectable. table 13.1.4.1 lists the specifications of special mode 2. table 13.1.4.2 lists the registers used in special mode 2 and the register values set. figure 13.1.4.1 shows communication control ex- ample for special mode 2. table 13.1.4.1. special mode 2 specifications item specification transfer data format ? transfer data length: 8 bits transfer clock ? master mode the ckdir bit in the u2mr register is set to 0 (internal clock) : fj/ (2(n+1)) fj = f 1sio , f 2sio , f 8sio , f 32sio . n: setting value of u2brg register 00 16 to ff 16 ? slave mode the ckdir bit is set to 1 (external clock selected) : input from clk2 pin transmit/receive control controlled by input/output ports transmission start condition ? before transmission can start, the following requirements must be met (1) _ the te bit in the u2c1 register is set to "1" (transmission enabled) _ the ti bit in the u2c1 register is set to "0" (data present in u2tb register) reception start condition ? before reception can start, the following requirements must be met (1) _ the re bit in the u2c1 register is set to "1" (reception enabled) _ the te bit in the u2c1 register is set to "1" (transmission enabled) _ the ti bit in the u2c1 register is set to "0" (data present in the u2tb register) ? while transmitting, one of the following conditions can be selected _ the u2irs bit in the u2c1 register is set to "0" (transmit buffer empty): when trans- ferring data from the u2tb register to the uart2 transmit register (at start of transmission) _ the u2irs bit is set to "1" (transfer completed): when the serial i/o finished sending data from the uart2 transmit register ? while receiving when transferring data from the uart2 receive register to the u2rb register (at completion of reception) error detection ? overrun error (2) this error occurs if the serial i/o started receiving the next data before reading the u2rb register and received the 7th bit of the next data select function ? clock phase setting selectable from four combinations of transfer clock polarities and phases interrupt request generation timing notes: 1. when an external clock is selected, the conditions must be met while if the ckpol bit in the u2c0 register 0 (transmit data output at the falling edge and the receive data taken in at the rising edge of the transfer clock), the external clock is in the high state; if the ckpol bit in the u2c0 register 1 (transmit data output at the rising edge and the receive data taken in at the falling edge of the transfer clock), the external clock is in the low state. 2. if an overrun error occurs, bits 8 to 0 in uirb register are undefined. the ir bit in the siric register remains unchanged.
13. serial i/o page 169 ) t 6 2 / c 6 1 m , b 6 2 / c 6 1 m , a 6 2 / c 6 1 m ( p u o r g a 6 2 / c 6 1 m 9 2 3 f o 7 0 0 2 , 5 1 . b e f 0 0 . 2 . v e r 0 0 2 0 - 2 0 2 0 b 9 0 j e r p1 3 p1 2 p7 0( txd 2 ) p7 2( clk 2 ) p7 1( rxd 2 ) p9 3 p7 0( txd 2 ) p7 2( clk 2 ) p7 1( rxd 2 ) p9 3 p7 0( txd 2 ) p7 2( clk 2 ) p7 1( rxd 2 ) microcomputer (master) microcomputer (slave) microcomputer (slave) figure 13.1.4.1. serial bus communication control example (uart2)
13. serial i/o page 170 ) t 6 2 / c 6 1 m , b 6 2 / c 6 1 m , a 6 2 / c 6 1 m ( p u o r g a 6 2 / c 6 1 m 9 2 3 f o 7 0 0 2 , 5 1 . b e f 0 0 . 2 . v e r 0 0 2 0 - 2 0 2 0 b 9 0 j e r table 13.1.4.2. registers to be used and settings in special mode 2 register bit function u2tb (1) 0 to 7 set transmission data u2rb (1) 0 to 7 reception data can be read oer overrun error flag u2brg 0 to 7 set a transfer rate u2mr (1) smd2 to smd0 set to 001 2 ckdir set this bit to 0 for master mode or 1 for slave mode iopol set to 0 u2c0 clk1, clk0 select the count source for the u2brg register crs invalid because crd = 1 txept transmit register empty flag crd set to 1 nch select txd2 pin output format ckpol clock phases can be set in combination with the ckph bit in the u2smr3 register uform set to 0 u2c1 te set this bit to 1 to enable transmission ti transmit buffer empty flag re set this bit to 1 to enable reception ri reception complete flag u2irs select uart2 transmit interrupt cause u2rrm, set to 0 u2lch, u2ere u2smr 0 to 7 set to 0 u2smr2 0 to 7 set to 0 u2smr3 ckph clock phases can be set in combination with the ckpol bit in the u2c0 register nodc set to 0 0, 2, 4 to 7 set to 0 u2smr4 0 to 7 set to 0 note: 1. not all bits in the register are described above. set those bits to 0 when writing to the registers in special mode 2.
13. serial i/o page 171 ) t 6 2 / c 6 1 m , b 6 2 / c 6 1 m , a 6 2 / c 6 1 m ( p u o r g a 6 2 / c 6 1 m 9 2 3 f o 7 0 0 2 , 5 1 . b e f 0 0 . 2 . v e r 0 0 2 0 - 2 0 2 0 b 9 0 j e r 13.1.4.1 clock phase setting function one of four combinations of transfer clock phases and polarities can be selected using the ckph bit in the u2smr3 register and the ckpol bit in the u2c0 register. make sure the transfer clock polarity and phase are the same for the master and slave to communi- cate. 13.1.4.1.1 master (internal clock) figure 13.1.4.1.1.1 shows the transmission and reception timing in master (internal clock). 13.1.4.1.2 slave (external clock) figure 13.1.4.1.2.1 shows the transmission and reception timing (ckph=0) in slave (external clock) while figure 13.1.4.1.2.2 shows the transmission and reception timing (ckph=1) in slave (external clock). data output timing data input timing d 0 d 1 d 2 d 3 d 4 d 6 d 7 d 5 clock output (ckpol=0, ckph=0) "h" "l" clock output (ckpol=1, ckph=0) "h" "l" clock output (ckpol=0, ckph=1) "h" "l" clock output (ckpol=1, ckph=1) "h" "l" "h" "l" figure 13.1.4.1.1.1. transmission and reception timing in master mode (internal clock)
13. serial i/o page 172 ) t 6 2 / c 6 1 m , b 6 2 / c 6 1 m , a 6 2 / c 6 1 m ( p u o r g a 6 2 / c 6 1 m 9 2 3 f o 7 0 0 2 , 5 1 . b e f 0 0 . 2 . v e r 0 0 2 0 - 2 0 2 0 b 9 0 j e r figure 13.1.4.1.2.1. transmission and reception timing (ckph=0) in slave mode (external clock) figure 13.1.4.1.2.2. transmission and reception timing (ckph=1) in slave mode (external clock) slave control input clock input (ckpol=0, ckph=0) clock input (ckpol=1, ckph=0) data output timing data input timing "h" "l" "h" "l" "h" "l" "h" "l" d 0 d 1 d 2 d 3 d 4 d 6 d 7 d 5 indeterminate clock input (ckpol=0, ckph=1) clock input (ckpol=1, ckph=1) data output timing data input timing "h" "l" "h " "l" "h " "l " "h " "l" d 0 d 1 d 2 d 3 d 6 d 7 d 4 d 5 . slave control input
13. serial i/o page 173 9 2 3 f o 7 0 0 2 , 5 1 . b e f 0 0 . 2 . v e r 0 0 2 0 - 2 0 2 0 b 9 0 j e r ) t 6 2 / c 6 1 m , b 6 2 / c 6 1 m , a 6 2 / c 6 1 m ( p u o r g a 6 2 / c 6 1 m 13.1.5 special mode 3 (ie bus mode )(uart2) in this mode, one bit of ie bus is approximated with one byte of uart mode waveform. table 13.1.5.1 lists the registers used in ie bus mode and the register values set. figure 13.1.5.1 shows the functions of bus collision detect function related bits. if the txd2 pin output level and rxd2 pin input level do not match, a uart2 bus collision detect interrupt request is generated. table 13.1.5.1. registers to be used and settings in ie bus mode register bit function u2tb 0 to 8 set transmission data u2rb (1) 0 to 8 reception data can be read oer,fer,per,sum error flag u2brg 0 to 7 set a transfer rate u2mr smd2 to smd0 set to 110 2 ckdir select the internal clock or external clock stps set to 0 pry invalid because prye=0 prye set to 0 iopol select the txd/rxd input/output polarity u2c0 clk1, clk0 select the count source for the u2brg register crs invalid because crd=1 txept transmit register empty flag crd set to 1 nch select txd2 pin output mode ckpol set to 0 uform set to 0 u2c1 te set this bit to 1 to enable transmission ti transmit buffer empty flag re set this bit to 1 to enable reception ri reception complete flag u2irs select the source of uart2 transmit interrupt u2rrm, set to 0 u2lch, u2ere u2smr 0 to 3, 7 set to 0 abscs select the sampling timing at which to detect a bus collision acse set this bit to 1 to use the auto clear function of transmit enable bit sss select the transmit start condition u2smr2 0 to 7 set to 0 u2smr3 0 to 7 set to 0 u2smr4 0 to 7 set to 0 note: 1. not all bits in the registers are described above. set those bits to 0 when writing to the registers in iebus mode.
13. serial i/o page 174 9 2 3 f o 7 0 0 2 , 5 1 . b e f 0 0 . 2 . v e r 0 0 2 0 - 2 0 2 0 b 9 0 j e r ) t 6 2 / c 6 1 m , b 6 2 / c 6 1 m , a 6 2 / c 6 1 m ( p u o r g a 6 2 / c 6 1 m (2) the acse bit in the u2smr register (auto clear of transmit enable bit) (1) the abscs bit in the u2smr register (bus collision detect sampling clock select) if abscs=0, bus collision is determined at the rising edge of the transfer clock transfer clock timer a0 (3) the sss bit in the u2smr register (transmit start condition select) transmission enable condition is met if sss bit = 1, the serial i/o starts sending data at the rising edge (1) of rxd2 txd2 clk2 txd2 rxd2 txd2 rxd2 st d0 d1 d2 d3 d4 d5 d6 d7 d8 sp input to ta0 in if abscs is set to "1", bus collision is determined when timer a0 (one-shot timer mode) underflows . txd2 rxd2 st d0 d1 d2 d3 d4 d5 d6 d7 d8 sp st d0 d1 d2 d3 d4 d5 d6 d7 d8 sp st d0 d1 d2 d3 d4 d5 d6 d7 d8 sp transfer clock bcnic register ir bit (1) u2c1 register te bit if acse bit is set to "1" automatically clear when bus collision occurs), the te bit is cleared to "0" (transmission disabled) when the ir bit in the bcnic register is set to "1" (unmatching detected). if sss bit is set to "0", the serial i/o starts sending data one transfer clock cycle after the transmission enable condition i s met. transfer clock (2) this diagram applies to the case where the iopol is set to "1" (reversed) . notes: 1. the falling edge of rxd2 when the iopol is set to "0"; the rising edge of rxd2 when the iopol is set to "1". 2. the transmit condition must be met before the falling edge (note 1) of rxd. figure 13.1.5.1. bus collision detect function-related bits
13. serial i/o page 175 9 2 3 f o 7 0 0 2 , 5 1 . b e f 0 0 . 2 . v e r 0 0 2 0 - 2 0 2 0 b 9 0 j e r ) t 6 2 / c 6 1 m , b 6 2 / c 6 1 m , a 6 2 / c 6 1 m ( p u o r g a 6 2 / c 6 1 m item specification transfer data format ? direct format ? inverse format transfer clock ? the ckdir bit in the u2mr register is set to 0 (internal clock) : fi/(16(n+1)) fi = f 1sio , f 2sio , f 8sio , f 32sio . n: setting value in u2brg register 00 16 to ff 16 ? the ckdir bit is set to 1 (external clock ) : f ext /(16(n+1)) f ext : input from clk 2 pin. n: setting value in u2brg register 00 16 to ff 16 transmission start condition ? before transmission can start, the following requirements must be met _ the te bit in the u2c1 register is set to "1" (transmission enabled) _ the ti bit in the u2c1 register is set to "0" (data present in u2tb register) reception start condition ? before reception can start, the following requirements must be met _ the re bit in the u2c1 register is set to "1" (reception enabled) _ start bit detection ? for transmission when the serial i/o finished sending data from the u2tb transfer register (the u2irs bit is set to "1") (2) ? for reception when transferring data from the uart2 receive register to the u2rb register (at completion of reception) error detection ? overrun error (1) this error occurs if the serial i/o started receiving the next data before reading the u2rb register and received the bit one before the last stop bit of the next data ? framing error this error occurs when the number of stop bits set is not detected ? parity error during reception, if a parity error is detected, parity error signal is output from the txd 2 pin. during transmission, a parity error is detected by the level of input to the r x d 2 pin when a transmission interrupt occurs ? error sum flag this flag is set to "1" when any of the overrun, framing, and parity errors is encountered 13.1.6 special mode 4 (sim mode) (uart2) based on uart mode, this is an sim interface compatible mode. direct and inverse formats can be implemented, and this mode allows output of a low from the txd2 pin when a parity error is detected. tables 13.1.6.1 lists the specifications of sim mode. table 13.1.6.2 lists the registers used in the sim mode and the register values set. table 13.1.6.1. sim mode specifications interrupt request generation timing notes: 1. if an overrun error occurs, bits 8 to 0 in uirb register are undefined. the ir bit in the siric register remains unchanged. 2. a transmit interrupt request is generated by setting the u2irs bit in the u2c1 register to 1 (transmission com- plete) and the u2ere bit to 1 (error signal output) after reset. therefore, when using sim mode, be sure to clear the ir bit to 0 (no interrupt request) after setting these bits.
13. serial i/o page 176 9 2 3 f o 7 0 0 2 , 5 1 . b e f 0 0 . 2 . v e r 0 0 2 0 - 2 0 2 0 b 9 0 j e r ) t 6 2 / c 6 1 m , b 6 2 / c 6 1 m , a 6 2 / c 6 1 m ( p u o r g a 6 2 / c 6 1 m table 13.1.6.2. registers to be used and settings in sim mode register bit function u2tb (1) 0 to 7 set transmission data u2rb (1) 0 to 7 reception data can be read oer,fer,per,sum error flag u2brg 0 to 7 set a transfer rate u2mr smd2 to smd0 set to 101 2 ckdir select the internal clock or external clock stps set to 0 pry set this bit to 1 for direct format or 0 for inverse format prye set to 1 iopol set to 0 u2c0 clk1, clk0 select the count source for the u2brg register crs invalid because crd=1 txept transmit register empty flag crd set to 1 nch set to 0 ckpol set to 0 uform set this bit to 0 for direct format or 1 for inverse format u2c1 te set this bit to 1 to enable transmission ti transmit buffer empty flag re set this bit to 1 to enable reception ri reception complete flag u2irs set to 1 u2rrm set to 0 u2lch set this bit to 0 for direct format or 1 for inverse format u2ere set to 1 u2smr (1) 0 to 3 set to 0 u2smr2 0 to 7 set to 0 u2smr3 0 to 7 set to 0 u2smr4 0 to 7 set to 0 note: 1. not all bits in registers are described above. set those bits to 0 when writing to the registers in sim mode.
13. serial i/o page 177 9 2 3 f o 7 0 0 2 , 5 1 . b e f 0 0 . 2 . v e r 0 0 2 0 - 2 0 2 0 b 9 0 j e r ) t 6 2 / c 6 1 m , b 6 2 / c 6 1 m , a 6 2 / c 6 1 m ( p u o r g a 6 2 / c 6 1 m figure 13.1.6.1. transmit and receive timing in sim mode d 0 d 1 d 2 d 3 d 4 d 5 d 6 d 7 st p d 0 d 1 d 2 d 3 d 4 d 5 d 6 d 7 st p sp d 0 d 1 d 2 d 3 d 4 d 5 d 6 d 7 st p d 0 d 1 d 2 d 3 d 4 d 5 d 6 d 7 st p sp d 0 d 1 d 2 d 3 d 4 d 5 d 6 d 7 st p d 0 d 1 d 2 d 3 d 4 d 5 d 6 d 7 st p sp sp d 0 d 1 d 2 d 3 d 4 d 5 d 6 d 7 st p d 0 d 1 d 2 d 3 d 4 d 5 d 6 d 7 st p sp sp start bit parity bit "0" "1" "0" "1" "0" "1" set to "0" by an interrupt request acknowledgement or by program tc transfer clock stop bit data is written to the uarti register an "l" signal is applied from the sim card due to a parity error an interrupt routine detects "h" or "l" txd2 "0 " "1 " transfer clock read the u2rb register rxd 2 pin level (2) txd 2 rxd 2 pin level (1) data is transferred from the u2tb register to the uart2 transmit register re bit in u2c1 register ri bit in u2c1 register ir bit in s2ric register te bit in u2c1 register ti bit in u2c1 register txept bit in u2 c0 register ir bit in s2tic register start bit set to "0" by an interrupt request acknowledgement or by program stop bit txd 2 outputs "l" due to a parity error parity bit "0 " "1" "0" "0" "1" (1) transmit timing (2) receive timing parity error signal returned from receiving end transmit waveform from the transmitting end "1" sp an interrupt routine detects "h" or "l" sp tc the above timing diagram applies to the case where data is transferred in the direct format. ? u2mr register stps bit = 0 (1 stop bit) ? u2mr register pry bit = 1 (even) ? u2c0 register uform bit = 0 (lsb first) ? u2c1 register u2lch bit = 0 (no reverse) ? u2c1 register u2irsch bit = 1 (transmit is completed) tc = 16 (n + 1) / fi or 16 (n + 1) / f ext fi : frequency of u2brg count source (f 1sio , f 2sio , f 8sio , f 32sio ) f ext : frequency of u2brg count source (external clock) n : value set to u2brg the above timing diagram applies to the case where data is transferred in the direct format. ? u2mr register stps bit = 0 (1 stop bit) ? u2mr register pry bit = 1 (even) ? u2c0 register uform bit = 0 (lsb first) ? u2c1 register u2lch bit = 0 (no reverse) ? u2c1 register u2irsch bit = 1 (transmit is completed) notes: 1. because txd 2 and rxd 2 are connected, this is composite waveform consisting of the txd 2 output and the parity error signal sent back from receiver. 2. because txd 2 and rxd 2 are connected, this is composite waveform consisting of the transmitter's transmit waveform and the parity error signal received. tc = 16 (n + 1) / fi or 16 (n + 1) / f ext fi : frequency of u2brg count source (f 1sio , f 2sio , f 8sio , f 32sio ) f ext : frequency of u2brg count source (external clock) n : value set to u2brg
13. serial i/o page 178 9 2 3 f o 7 0 0 2 , 5 1 . b e f 0 0 . 2 . v e r 0 0 2 0 - 2 0 2 0 b 9 0 j e r ) t 6 2 / c 6 1 m , b 6 2 / c 6 1 m , a 6 2 / c 6 1 m ( p u o r g a 6 2 / c 6 1 m figure 13.1.6.2 shows the example of connecting the sim interface. connect t x d 2 and r x d 2 and apply pull-up. figure 13.1.6.2. sim interface connection microcomputer sim card txd 2 rxd 2 13.1.6.1 parity error signal output the parity error signal is enabled by setting the u2ere bit in the u2c1 register to 1 . ? when receiving the parity error signal is output when a parity error is detected while receiving data. this is achieved by pulling the txd2 output low with the timing shown in figure 13.1.6.1.1. if the r2rb register is read while outputting a parity error signal, the per bit is cleared to 0 and at the same time the txd2 output is returned high. ? when transmitting a transmission-finished interrupt request is generated at the falling edge of the transfer clock pulse that immediately follows the stop bit. therefore, whether a parity signal has been returned can be determined by reading the port that shares the rxd2 pin in a transmission-finished interrupt service routine. figure 13.1.6.1.1. parity error signal output timing d0 d1 d2 d3 d4 d5 d6 d7 psp st (1) transfer clock rxd 2 txd 2 u2c1 register ri bit h l h l h l 1 0 this timing diagram applies to the case where the direct format is implemented. note: 1. the output of microcomputer is in the high-impedance state (pulled up externally). st: start bit p: even parity sp: stop bit
13. serial i/o page 179 9 2 3 f o 7 0 0 2 , 5 1 . b e f 0 0 . 2 . v e r 0 0 2 0 - 2 0 2 0 b 9 0 j e r ) t 6 2 / c 6 1 m , b 6 2 / c 6 1 m , a 6 2 / c 6 1 m ( p u o r g a 6 2 / c 6 1 m 13.1.6.2 format ? direct format set the pry bit in the u2mr register to 1 , the uform bit in the u2c0 register to 0 and the u2lch bit in the u2c1 register to 0 . ? inverse format set the pry bit to 0 , uform bit to 1 and u2lch bit to 1 . figure 13.1.6.2.1 shows the sim interface format. figure 13.1.6.2.1. sim interface format p : even parity d0 d1 d2 d3 d4 d5 d6 d7 p transfer clcck txd 2 txd 2 d7 d6 d5 d4 d3 d2 d1 d0 p transfer clcck (1) direct format h l h l (2) inverse format p : odd parity h l h l
14. a/d converter page 180 9 2 3 f o 7 0 0 2 , 5 1 . b e f 0 0 . 2 . v e r 0 0 2 0 - 2 0 2 0 b 9 0 j e r ) t 6 2 / c 6 1 m , b 6 2 / c 6 1 m , a 6 2 / c 6 1 m ( p u o r g a 6 2 / c 6 1 m item performance a/d conversion method successive approximation (capacitive coupling amplifier) analog input voltage (1) 0v to av cc (v cc ) operating clock fad (2) f ad /divided-by-2 or f ad /divided-by-3 or f ad /divided-by-4 or f ad /divided-by-6 or f ad /divided-by-12 or f ad resolution 8-bit or 10-bit (selectable) integral nonlinearity error when av cc = v ref = 5v ? with 8-bit resolution: ? with 10-bit resolution: ? with 8-bit resolution: ? with 10-bit resolution: ? without sample and hold function 8-bit resolution: 49 f ad cycles , 10-bit resolution: 59 f ad cycles ? with sample and hold function 8-bit resolution: 28 f ad cycles , 10-bit resolution: 33 f ad cycles table 14.1 a/d converter performance notes: 1. not dependent on use of sample and hold function. 2. set the 14. a/d converter note p9 2 and p9 3 (an 32 , an 24 ) are not available in the 42-pin package. do not use p9 2 and p9 3 (an 32 , an 24 ) as analog input pins in the 42-pin package. the microcomputer contains one a/d converter circuit based on 10-bit successive approximation method configured with a capacitive-coupling amplifier. the analog inputs share the pins with p10 0 to p10 7 (an 0 to ___________ an 7 ), p9 0 to p9 3 (an3 0 to an3 2 , an2 4 ). similarly, ad trg input shares the pin with p1 5 . therefore, when using these inputs, make sure the corresponding port direction bits are set to 0 (input mode). when not using the a/d converter, set the vcut bit to 0 (v ref unconnected), so that no current will flow from the v ref pin into the resistor ladder, helping to reduce the power consumption of the chip. the a/d conversion result is stored in the i bits in the a/d register for an i , an 3i , and an 2i pins (i = 0 to 7). table 14.1 shows the a/d converter performance. figure 14.1 shows the a/d converter block diagram and figures 14.2 to 14.4 show the a/d converter associated with registers.
14. a/d converter page 181 9 2 3 f o 7 0 0 2 , 5 1 . b e f 0 0 . 2 . v e r 0 0 2 0 - 2 0 2 0 b 9 0 j e r ) t 6 2 / c 6 1 m , b 6 2 / c 6 1 m , a 6 2 / c 6 1 m ( p u o r g a 6 2 / c 6 1 m figure 14.1 a/d converter block diagram =000 2 =001 2 =010 2 =011 2 =100 2 =101 2 =110 2 =111 2 an 0 an 1 an 2 an 3 an 4 an 5 an 6 an 7 an 30 an 31 an 32 v ref v in ch2 to ch0 decoder for channel selection a/d register 0(16) data bus low-order v ref av ss vcut=0 vcut=1 data bus high-order port p10 group port p9 group adgsel1 to adgsel0=01 2 adgsel1 to adgsel0=00 2 an 24 adgsel1 to adgsel0=11 2 f ad cks0=1 cks0=0 cks1=1 cks1=0 1/3 cks2=0 cks2=1 1/2 1/ 2 ? ad a/d conversion rate selection (03c1 16 to 03c0 16 ) (03c3 16 to 03c2 16 ) (03c5 16 to 03c4 16 ) (03c7 16 to 03c6 16 ) (03c9 16 to 03c8 16 ) (03cb 16 to 03ca 16 ) (03cd 16 to 03cc 16 ) (03cf 16 to 03ce 16 ) resistor ladder successive conversion register adcon0 register (address 03d6 16 ) adcon1 register (address 03d7 16 ) comparator 0 addresses decoder for a/d register a/d register 1(16) a/d register 2(16) a/d register 3(16) a/d register 4(16) a/d register 5(16) a/d register 6(16) a/d register 7(16) adcon2 register (address 03d4 16 ) port p9 group =000 2 =001 2 =010 2 =100 2 ch2 to ch0 ch2 to ch0 sse = 1 ch2 to ch0=001 2 comparator 1 adgsel1 to adgsel0=00 2 adgsel1 to adgsel0=01 2 v in 1 (1) (1) note: 1. an 32 and an 24 are available for only 48-pin package.
14. a/d converter page 182 9 2 3 f o 7 0 0 2 , 5 1 . b e f 0 0 . 2 . v e r 0 0 2 0 - 2 0 2 0 b 9 0 j e r ) t 6 2 / c 6 1 m , b 6 2 / c 6 1 m , a 6 2 / c 6 1 m ( p u o r g a 6 2 / c 6 1 m figure 14.2 adcon0 to adcon2 registers a/d control register 0 (1) symbol address after reset adcon0 03d6 16 00000xxx 2 b7 b6 b5 b4 b3 b2 b1 b0 analog input pin select bit ch0 bit symbol bit name functio n ch1 ch2 a/d operation mode select bit 0 0 0 : one-shot mode or delayed trigger mode 0,1 0 1 : repeat mode 1 0 : single sweep mode or simultaneous sample sweep mode 1 1 : repeat sweep mode 0 or repeat sweep mode 1 md0 md1 trigger select bit 0 : software trigger 1 : hardware trigger trg adst a/d conversion start flag 0 : a/d conversion disabled 1 : a/d conversion started frequency select bit 0 see table 14.2 a/d conversion frequency select cks0 rw a/d control register 1 (1) symbol address after reset adcon1 03d7 16 00 16 bit name function bit symbol b7 b6 b5 b4 b3 b2 b1 b0 a/d sweep pin select bit scan0 scan1 md2 bits 8/10-bit mode select bit 0 : 8-bit mode 1 : 10-bit mode vcut v ref connect bit (2) a/d operation mode select bit 1 0 : other than repeat sweep mode 1 1 : repeat sweep mode 1 0 : v ref not connected 1 : v ref connected b4 b3 note: 1. if the adcon0 register is rewritten during a/d conversion, the conversion result will be indeterminate. frequency select bit 1 cks1 rw rw rw rw rw rw rw rw rw rw rw rw rw rw rw function varies with each operation mode function varies with each operation mode see table 14.2 a/d conversion frequency select nothing is assigned. when write, set to 0 . when read, its content is 0 . (b7-b6) notes: 1. if the adcon1 register is rewritten during a/d conversion, the conversion result will be indeterminate. 2. if the vcut bit is reset from 0 (v ref unconnected) to 1 (v ref connected), wait for 1 0 0 a/d input group select bit 0 0 : select port p10 group 0 1 : select port p9 group (an 3i ) 1 0 : do not set 1 1 : select port p9 group (an 24 ) b2 b1 frequency select bit 2 cks2 adgsel0 adgsel1 rw rw rw rw rw (b3) nothing is assigned. when write, set to 0 . when read, its content is 0 . (b7-b6) rw trg1 trigger select bi t see table 14.2 a/d conversion frequency select function varies with each operation mode
14. a/d converter page 183 9 2 3 f o 7 0 0 2 , 5 1 . b e f 0 0 . 2 . v e r 0 0 2 0 - 2 0 2 0 b 9 0 j e r ) t 6 2 / c 6 1 m , b 6 2 / c 6 1 m , a 6 2 / c 6 1 m ( p u o r g a 6 2 / c 6 1 m a/d trigger control register (1,2) symbol address after reset adtrgcon 03d2 16 00 16 b7 b6 b5 b4 b3 b2 b1 b0 a/d operation mode select bit 2 0 : other than simultaneous sample sweep mode or delayed trigger mode 0,1 1 : simultaneous sample sweep mode or delayed trigger mode 0,1 bit symbol bit name function rw sse a/d operation mode select bit 3 hptrg1 dte hptrg0 rw rw rw rw nothing is assigned. when write, set to 0 . when read, its content is 0 . (b7-b4) 0 : other than delayed trigger mode 0,1 1 : delayed trigger mode 0,1 an1 trigger select bit an0 trigger select bit function varies with each operation mode function varies with each operation mode notes: 1. if the adtrgcon register is rewritten during a/d conversion, the conversion result will be indeterminate. 2. set 00 16 in this register in one-shot mode, repeat mode, single sweep mode, repeat sweep mode 0 and repeat sweep mode 1. figure 14.3 adtrgcon register cks2 cks1 cks0 ? ad 000 001 010 100 101 110 111 divided-by-4 of f ad divided-by-2 of f ad f ad divided-by-12 of f ad 011 divided-by-6 of f ad divided-by-3 of f ad table 14.2 a/d conversion frequency select note: 1. set the
14. a/d converter page 184 9 2 3 f o 7 0 0 2 , 5 1 . b e f 0 0 . 2 . v e r 0 0 2 0 - 2 0 2 0 b 9 0 j e r ) t 6 2 / c 6 1 m , b 6 2 / c 6 1 m , a 6 2 / c 6 1 m ( p u o r g a 6 2 / c 6 1 m figure 14.4 adstat0 register and ad0 to ad7 registers a/d register i (i=0 to 7) symbol address after reset ad0 03c1 16 to 03c0 16 indeterminate ad1 03c3 16 to 03c2 16 indeterminate ad2 03c5 16 to 03c4 16 indeterminate ad3 03c7 16 to 03c6 16 indeterminate ad4 03c9 16 to 03c8 16 indeterminate ad5 03cb 16 to 03ca 16 indeterminate ad6 03cd 16 to 03cc 16 indeterminate ad7 03cf 16 to 03ce 16 indeterminate eight low-order bits of a/d conversion result functio n (b15) b7 b7 b0 b0 (b8) when the bits bit in the adcon1 register is 1 (10-bit mode) nothing is assigned. when write, set to 0 . when read, its content is 0 . when read, its content is indeterminate rw ro ro two high-order bits of a/d conversion result when the bits bit in the adcon1 register is 0 (8-bit mode) a/d conversion result a/d conversion status register 0 (1) symbol address after reset adstat0 03d3 16 00 16 b7 b6 b5 b4 b3 b2 b1 b0 an1 trigger status flag 0 : an1 trigger did not occur during an0 conversion 1 : an1 trigger occured during an0 conversion bit symbol bit name function r w aderr0 conversion termination flag an0 conversion status flag adstt0 aderr1 adtcsf rw ro rw ro ro nothing is assigned. when write, set to 0 . when read, its content is 0 . (b2 ) adstrt0 an0 conversion completion status flag 0 : conversion not terminated 1 : conversion terminated by timer b0 underflo w delayed trigger sweep status flag 0 : sweep not in progress 1 : sweep in progress 0 : an0 conversion not in progress 1 : an0 conversion in progress adstt1 rw 0 : an0 conversion not completed 1 : an0 conversion completed adstrt1 rw an1 conversion status flag 0 : an1 conversion not in progress 1 : an1 conversion in progress an1 conversion completion status flag 0 : an1 conversion not completed 1 : an1 conversion completed note: 1. adstat0 register is valid only when the dte bit in the adtrgcon register is set to 1 .
14. a/d converter page 185 9 2 3 f o 7 0 0 2 , 5 1 . b e f 0 0 . 2 . v e r 0 0 2 0 - 2 0 2 0 b 9 0 j e r ) t 6 2 / c 6 1 m , b 6 2 / c 6 1 m , a 6 2 / c 6 1 m ( p u o r g a 6 2 / c 6 1 m figure 14.5 tb2sc register pwcom symbol address after reset tb2sc 039e 16 x0000000 2 timer b2 reload timing switch bit 0 : timer b2 underflow 1 : timer a output at odd-numbered timer b2 special mode register (1) bit name function bit symbol b7 b6 b5 b4 b3 b2 b1 b0 ivpcr1 three-phase output port sd control bit 1 0 : three-phase output forcible cutoff by sd pin input (high impedance) disabled 1 : three-phase output forcible cutoff by sd pin input (high impedance) enabled rw rw rw nothing is assigned. when write, set to 0 . when read, its content is 0 . (b7) tb2sel trigger select bit 0 : tb2 interrupt 1 : underflow of tb2 interrupt generation frequency setting counter [ictb2] rw rw tb0en timer b0 operation mode select bit 0 : other than a/d trigger mode 1 : a/d trigger mode (5) rw tb1en timer b1 operation mode select bit 0 : other than a/d trigger mode 1 : a/d trigger mode (5) rw (2) (3, 4, 7) (6) (b6-b5) reserved bits must set to "0" 0 0 notes: 1. write to this register after setting the prc1 bit in the prcr register to "1" (write enabled). 2. if the inv11 bit is "0" (three-phase mode 0) or the inv06 bit is "1" (triangular wave modulation mode), set this bit to "0" (timer b2 underflow). 3. when setting the ivpcr1 bit to "1" (three-phase output forcible cutoff by sd pin input enabled), set the pd8_5 bit to "0" (= input mode). 4. related pins are u(p8 0 ), u(p8 1 ), v(p7 2 ), v(p7 3 ), w(p7 4 ), w(p7 5 ). when a high-level ("h") signal is applied to the sd pin and set the ivpcr1 bit to 0 after forcible cutoff, pins u, u, v, v, w, and w are exit from the high-impedance state. if a low-level ( l ) signal is applied to the sd pin, three-phase motor control timer output will be disabled (inv03=0). at this time, when the ivpcr1 bit is 0, pins u, u, v, v, w, and w become programmable i/o ports. when the ivpcr1 bit is set to 1, pins u, u, v, v, w, and w are placed in a high-impedance state regardless of which function of those pins is used. 5. when this bit is used in delayed trigger mode 0, set the tb0en and tb1en bits to "1"(a/d trigger mode). 6. when setting the tb2sel bit to "1" (underflow of tb2 interrupt generation frequency setting counter[ictb2]), set the inv02 bit to "1" (three-phase motor control timer function). 7. re f er to 16.6 digita l debou n ce f u n ctio n f or sd input.
14. a/d converter page 186 9 2 3 f o 7 0 0 2 , 5 1 . b e f 0 0 . 2 . v e r 0 0 2 0 - 2 0 2 0 b 9 0 j e r ) t 6 2 / c 6 1 m , b 6 2 / c 6 1 m , a 6 2 / c 6 1 m ( p u o r g a 6 2 / c 6 1 m 14.1 operation modes 14.1.1 one-shot mode in one-shot mode, analog voltage applied to a selected pin is once converted to a digital code. table 14.1.1.1 shows the one-shot mode specifications. figure 14.1.1.1 shows the operation example in one- shot mode. figure 14.1.1.2 shows the adcon0 to adcon2 registers in one-shot mode. table 14.1.1.1 one-shot mode specifications item specification function the ch2 to ch0 bits in the adcon0 register and the adgsel1 to adgsel0 bits in the adcon2 register select pins. analog voltage applied to a selected pin is once converted to a digital code a/d conversion start ? when the trg bit in the adcon0 register is 0 (software trigger) condition set the adst bit in the adcon0 register to 1 (a/d conversion started) ? when the trg bit in the adcon0 register is 1 (hardware trigger) ___________ the ad trg pin input changes state from h to l after setting the adst bit to 1 (a/d conversion started) a/d conversion stop ? a/d conversion completed (if a software trigger is selected, the adst bit is condition set to 0 (a/d conversion halted)). ? set the adst bit to 0 interrupt request generation timing a/d conversion completed analog input pin select one pin from an 0 to an 7 , an 30 to an 32 , an 24 readout of a/d conversion result readout one of the ad0 to ad7 registers that corresponds to the selected pin figure 14.1.1.1 operation example in one-shot mode ? example when selecting an 2 to an analog input pin (ch2 to ch0=010 2 ) an 0 an 1 an 2 an 3 an 4 an 5 an 6 an 7 a/d conversion started a/d interrupt request generated a/d pin input voltage sampling a/d pin conversion
14. a/d converter page 187 9 2 3 f o 7 0 0 2 , 5 1 . b e f 0 0 . 2 . v e r 0 0 2 0 - 2 0 2 0 b 9 0 j e r ) t 6 2 / c 6 1 m , b 6 2 / c 6 1 m , a 6 2 / c 6 1 m ( p u o r g a 6 2 / c 6 1 m a/d control register 0 (1) symbol address after reset adcon0 03d6 16 00000xxx 2 b7 b6 b5 b4 b3 b2 b1 b0 analog input pin select bit (2, 3) ch0 bit symbol bit name function ch1 ch2 a/d operation mode select bit 0 (3) md0 md 1 trigger select bit trg adst a/d conversion start flag 0 : a/d conversion disabled 1 : a/d conversion started frequency select bit 0 cks0 rw a/d control register 1 (1) symbol address after reset adcon1 03d7 16 00 16 bit name function bit symbol b7 b6 b5 b4 b3 b2 b1 b0 a/d sweep pin select bit scan0 scan1 md 2 bits 8/10-bit mode select bit 0 : 8-bit mode 1 : 10-bit mode vcut v ref connect bit (2) a/d operation mode select bit 1 1 : v ref connected 0 0 0 0 : one-shot mode or delayed trigger mode 0,1 b4 b3 1 frequency select bit 1 cks1 0 : any mode other than repeat sweep mode 1 rw rw rw rw rw rw rw rw rw rw rw rw rw rw rw see table 14.2 a/d conversion frequency select refer to table 14.2 a/d conversion frequency select (b7-b6) 0 note: 1. if the adcon2 register is rewritten during a/d conversion, the conversion result will be indeterminate. a/d control register 2 (1) symbol address after reset adcon2 03d4 16 00 16 b7 b6 b5 b4 b3 b2 b1 b0 a/d conversion method select bit bit symbol bit name function rw smp reserved bit set to 0 0 a/d input group select bit 0 0 : select port p10 group (an i ) 0 1 : select port p9 group (an 3i ) 1 0 : do not set 1 1 : select port p9 group (an 24 ) b2 b1 frequency select bit 2 cks2 adgsel0 adgsel1 rw rw rw rw rw (b3) nothing is assigned. when write, set to 0 . when read, its content is 0 . (b7-b6) rw trg1 trigger select bit 1 b2 b1 b0 0 0 0 : select an 0 0 0 1 : select an 1 0 1 0 : select an 2 0 1 1 : select an 3 1 0 0 : select an 4 1 0 1 : select an 5 1 1 0 : select an 6 1 1 1 : select an 7 0 : software trigger 1 : hardware trigger (ad trg trigger) invalid in one-shot mode nothing is assigned. when write, set to 0 . when read, its content is 0 . 0 : without sample and hold 1 : with sample and hold set to "0" in one-shot mode see table 14.2 a/d conversion frequency select 0 notes: 1. if the adcon0 register is rewritten during a/d conversion, the conversion result will be indeterminate. 2. an 30 to an 32 and an 24 can be used in the same way as an 0 to an 7 . use the adgsel1 to adgsel0 bits in the adcon2 register to select the desired pin. 3. after rewriting the md1 to md0 bits, set the ch2 to ch0 bits over again using an another instruction. notes: 1. if the adcon1 register is rewritten during a/d conversion, the conversion result will be indeterminate. 2. if the vcut bit is reset from 0 (v ref unconnected) to 1 (v ref connected), wait for 1 figure 14.1.1.2 adcon0 to adcon2 registers in one-shot mode
14. a/d converter page 188 9 2 3 f o 7 0 0 2 , 5 1 . b e f 0 0 . 2 . v e r 0 0 2 0 - 2 0 2 0 b 9 0 j e r ) t 6 2 / c 6 1 m , b 6 2 / c 6 1 m , a 6 2 / c 6 1 m ( p u o r g a 6 2 / c 6 1 m 14.1.2 repeat mode in repeat mode, analog voltage applied to a selected pin is repeatedly converted to a digital code. table 14.1.2.1 shows the repeat mode specifications. figure 14.1.2.1 shows the operation example in repeat mode. figure 14.1.2.2 shows the adcon0 to adcon2 registers in repeat mode. item specification function the ch2 to ch0 bits in the adcon0 register and the adgsel1 to adgsel0 bits in the adcon2 register select pins. analog voltage applied to a selected pin is repeatedly converted to a digital code a/d conversion start ? when the trg bit in the adcon0 register is 0 (software trigger) condition set the adst bit in the adcon0 register to 1 (a/d conversion started) ? when the trg bit in the adcon0 register is 1 (hardware trigger) the ad trg pin input changes state from h to l after setting the adst bit to 1 (a/d conversion started) a/d conversion stop condition set the adst bit to 0 (a/d conversion halted) interrupt request generation timing none generated analog input pin select one pin from an 0 to an 7 , an 30 to an 32 and an 24 readout of a/d conversion result readout one of the ad0 to ad7 registers that corresponds to the selected pin table 14.1.2.1 repeat mode specifications figure 14.1.2.1 operation example in repeat mode ? example when selecting an 2 to an analog input pin (ch2 toch0=010 2 ) a/d conversion started an 0 an 1 an 2 an 3 an 4 an 5 an 6 an 7 a/d pin input voltage sampling a/d pin conversion
14. a/d converter page 189 9 2 3 f o 7 0 0 2 , 5 1 . b e f 0 0 . 2 . v e r 0 0 2 0 - 2 0 2 0 b 9 0 j e r ) t 6 2 / c 6 1 m , b 6 2 / c 6 1 m , a 6 2 / c 6 1 m ( p u o r g a 6 2 / c 6 1 m a/d control register 0 (1) symbol address after reset adcon0 03d6 16 00000xxx 2 b7 b6 b5 b4 b3 b2 b1 b0 analog input pin select bit (2, 3) ch0 bit symbol bit name function ch1 ch2 a/d operation mode select bit 0 (3) md0 md 1 trigger select bit trg adst a/d conversion start flag 0 : a/d conversion disabled 1 : a/d conversion started frequency select bit 0 cks0 rw a/d control register 1 (1) symbol address after reset adcon1 03d7 16 00 16 bit name function bit symbol b7 b6 b5 b4 b3 b2 b1 b0 a/d sweep pin select bit scan0 scan1 md 2 bits 8/10-bit mode select bit 0 : 8-bit mode 1 : 10-bit mode vcut v ref connect bit (2) a/d operation mode select bit 1 1 : v ref connected 0 0 0 1 : repeat mode b4 b3 1 frequency select bit 1 cks1 0 : any mode other than repeat sweep mode 1 rw rw rw rw rw rw rw rw rw rw rw rw rw rw rw refer to table 14.2 a/d conversion frequency select refer to table 14.2 a/d conversion frequency select (b7-b6) 1 note: 1. if the adcon2 register is rewritten during a/d conversion, the conversion result will be indeterminate. a/d control register 2 (1) symbol address after reset adcon2 03d4 16 00 16 b7 b6 b5 b4 b3 b2 b1 b0 a/d conversion method select bit bit symbol bit name function rw smp reserved bit set to 0 0 a/d input group select bit 0 0 : select port p10 group (an i ) 0 1 : select port p9 group (an 3i ) 1 0 : do not set 1 1 : select port p9 group (an 24 ) b2 b1 frequency select bit 2 cks2 adgsel0 adgsel1 rw rw rw rw rw (b3) nothing is assigned. when write, set to 0 . when read, its content is 0 . (b7-b6) see table 14.2 a/d conversion frequency select rw trg1 trigger select bit 1 b2 b1 b0 0 0 0 : select an 0 0 0 1 : select an 1 0 1 0 : select an 2 0 1 1 : select an 3 1 0 0 : select an 4 1 0 1 : select an 5 1 1 0 : select an 6 1 1 1 : select an 7 0 : software trigger 1 : hardware trigger (ad trg trigger) invalid in repeat mode nothing is assigned. when write, set to 0 . when read, its content is 0 . 0 : without sample and hold 1 : with sample and hold set to "0" in repeat mode 0 notes: 1. if the adcon1 register is rewritten during a/d conversion, the conversion result will be indeterminate. 2. if the vcut bit is reset from 0 (v ref unconnected) to 1 (v ref connected), wait for 1 figure 14.1.2.2 adcon0 to adcon2 registers in repeat mode
14. a/d converter page 190 9 2 3 f o 7 0 0 2 , 5 1 . b e f 0 0 . 2 . v e r 0 0 2 0 - 2 0 2 0 b 9 0 j e r ) t 6 2 / c 6 1 m , b 6 2 / c 6 1 m , a 6 2 / c 6 1 m ( p u o r g a 6 2 / c 6 1 m 14.1.3 single sweep mode in single sweep mode, analog voltages applied to the selected pins are converted one-by-one to a digital code. table 14.1.3.1 shows the single sweep mode specifications. figure 14.1.3.1 shows the operation example in single sweep mode. figure 14.1.3.2 shows the adcon0 to adcon2 registers in single sweep mode. item specification function the scan1 to scan0 bits in the adcon1 register and the adgsel1 to adgsel0 bits in the adcon2 register select pins. analog voltage applied to the selected pins is converted one-by-one to a digital code a/d conversion start condition ? when the trg bit in the adcon0 register is 0 (software trigger) set the adst bit in the adcon0 register to 1 (a/d conversion started) ? when the trg bit in the adcon0 register is 1 (hardware trigger) the ad trg pin input changes state from h to l after setting the adst bit to 1 (a/d conversion started) a/d conversion stop condition ? a/d conversion completed(when selecting a software trigger, the adst bit is set to 0 (a/d conversion halted)). ? set the adst bit to 0 interrupt request generation timing a/d conversion completed analog input pin select from an 0 to an 1 (2 pins), an 0 to an 3 (4 pins), an 0 to an 5 (6 pins), an 0 to an 7 (8 pins) (1) readout of a/d conversion result readout one of the ad0 to ad7 registers that corresponds to the selected pin table 14.1.3.1 single sweep mode specifications note: 1. an 30 to an 32 can be used in the same way as an 0 to an 7 . however, all input pins need to belong to the same group. figure 14.1.3.1 operation example in single sweep mode ? example when selecting an 0 to an 3 to analog input pins (scan1 to scan0=01 2 ) a/d conversion started a/d interrupt request generated an 0 an 1 an 2 an 3 an 4 an 5 an 6 an 7 a/d pin input voltage sampling a/d pin conversion
14. a/d converter page 191 9 2 3 f o 7 0 0 2 , 5 1 . b e f 0 0 . 2 . v e r 0 0 2 0 - 2 0 2 0 b 9 0 j e r ) t 6 2 / c 6 1 m , b 6 2 / c 6 1 m , a 6 2 / c 6 1 m ( p u o r g a 6 2 / c 6 1 m a/d control register 0 (1) symbol address after reset adcon0 03d6 16 00000xxx 2 b7 b6 b5 b4 b3 b2 b1 b0 analog input pin select bit ch0 bit symbol bit name function ch1 ch2 a/d operation mode select bit 0 md0 md 1 trigger select bit trg adst a/d conversion start flag 0 : a/d conversion disabled 1 : a/d conversion started frequency select bit 0 cks0 rw a/d control register 1 (1) symbol address after reset adcon1 03d7 16 00 16 bit name function bit symbol b7 b6 b5 b4 b3 b2 b1 b0 a/d sweep pin select bit (2) scan0 scan1 md 2 bits 8/10-bit mode select bit 0 : 8-bit mode 1 : 10-bit mode vcut v ref connect bit (3) a/d operation mode select bit 1 1 : v ref connected 1 0 1 frequency select bit 1 cks1 0 : any mode other than repeat sweep mode 1 rw rw rw rw rw rw rw rw rw rw rw rw rw rw rw refer to table 14.2 a/d conversion frequency select refer to table 14.2 a/d conversion frequency select (b7-b6) 0 note: 1. if the adcon2 register is rewritten during a/d conversion, the conversion result will be indeterminate. a/d control register 2 (1) symbol address after reset adcon2 03d4 16 00 16 b7 b6 b5 b4 b3 b2 b1 b0 a/d conversion method select bit bit symbol bit name function rw smp reserved bit set to 0 0 a/d input group select bit 0 0 : select port p10 group (an i ) 0 1 : select port p9 group (an 3i ) 1 0 : do not set 1 1 : do not set b2 b1 frequency select bit 2 cks2 adgsel0 adgsel1 rw rw rw rw rw (b3) nothing is assigned. when write, set to 0 . when read, its content is 0 . (b7-b6) refer to table 14.2 a/d conversion frequency select rw trg1 trigger select bit 1 note: 1. if the adcon0 register is rewritten during a/d conversion, the conversion result will be indeterminate. 0 : software trigger 1 : hardware trigger (ad trg trigger) nothing is assigned. when write, set to 0 . when read, its content is 0 . 0 : without sample and hold 1 : with sample and hold set to "0" in single sweep mode invalid in single sweep mode 1 0 : single sweep mode or simultaneous sample sweep mode b4 b3 when selecting single sweep mode 0 0 : an 0 to an 1 (2 pins) 0 1 : an 0 to an 3 (4 pins) 1 0 : an 0 to an 5 (6 pins) 1 1 : an 0 to an 7 (8 pins) b1 b0 0 notes: 1. if the adcon1 register is rewritten during a/d conversion, the conversion result will be indeterminate. 2. an 30 to an 32 can be used in the same way as an 0 to an 7 . use the adgsel1 to adgsel0 bits in the adcon2 register to select the desired pin. 3. if the vcut bit is reset from 0 (v ref unconnected) to 1 (v ref connected), wait for 1 figure 14.1.3.2 adcon0 to adcon2 registers in single sweep mode
14. a/d converter page 192 9 2 3 f o 7 0 0 2 , 5 1 . b e f 0 0 . 2 . v e r 0 0 2 0 - 2 0 2 0 b 9 0 j e r ) t 6 2 / c 6 1 m , b 6 2 / c 6 1 m , a 6 2 / c 6 1 m ( p u o r g a 6 2 / c 6 1 m item specification function the scan1 to scan0 bits in the adcon1 register and the adgsel1 to adgsel0 bits in the adcon2 register select pins. analog voltage applied to the selected pins is repeatedly converted to a digital code a/d conversion start condition ? when the trg bit in the adcon0 register is 0 (software trigger) set the adst bit in the adcon0 register to 1 (a/d conversion started) ? when the trg bit in the adcon0 register is 1 (hardware trigger) the ad trg pin input changes state from h to l after setting the adst bit to 1 (a/d conversion started) a/d conversion stop condition set the adst bit to 0 (a/d conversion halted) interrupt request generation timing none generated analog input pin select from an 0 to an 1 (2 pins), an 0 to an 3 (4 pins), an 0 to an 5 (6 pins), an 0 to an 7 (8 pins) (1) readout of a/d conversion result readout one of the ad0 to ad7 registers that corresponds to the selected pin 14.1.4 repeat sweep mode 0 in repeat sweep mode 0, analog voltages applied to the selected pins are repeatedly converted to a digital code. table 14.1.4.1 shows the repeat sweep mode 0 specifications. figure 14.1.4.1 shows the operation example in repeat sweep mode 0. figure 14.1.4.2 shows the adcon0 to adcon2 registers in repeat sweep mode 0. table 14.1.4.1 repeat sweep mode 0 specifications note: 1. an 30 to an 32 can be used in the same way as an 0 to an 7 . however, all input pins need to belong to the same group. figure 14.1.4.1 operation example in repeat sweep mode 0 ? example when selecting an 0 to an 3 to analog input pins (scan1 to scan0=01 2 ) a/d conversion started an 0 an 1 an 2 an 3 an 4 an 5 an 6 an 7 a/d pin input voltage sampling a/d pin conversion
14. a/d converter page 193 9 2 3 f o 7 0 0 2 , 5 1 . b e f 0 0 . 2 . v e r 0 0 2 0 - 2 0 2 0 b 9 0 j e r ) t 6 2 / c 6 1 m , b 6 2 / c 6 1 m , a 6 2 / c 6 1 m ( p u o r g a 6 2 / c 6 1 m a/d control register 1 (1) symbol address after reset adcon1 03d7 16 00 16 bit name function bit symbol b7 b6 b5 b4 b3 b2 b1 b0 a/d sweep pin select bit (2) scan0 scan1 md 2 bits 8/10-bit mode select bit 0 : 8-bit mode 1 : 10-bit mode vcut v ref connect bit (3) a/d operation mode select bit 1 1 : v ref connected 0 1 frequency select bit 1 cks1 0 : any mode other than repeat sweep mode 1 rw rw rw rw rw rw rw refer to table 14.2 a/d conversion frequency select (b7-b6) nothing is assigned. when write, set to 0 . when read, its content is 0 . when selecting repeat sweep mode 0 0 0 : an 0 to an 1 (2 pins) 0 1 : an 0 to an 3 (4 pins) 1 0 : an 0 to an 5 (6 pins) 1 1 : an 0 to an 7 (8 pins) b1 b0 note: 1. if the adcon2 register is rewritten during a/d conversion, the conversion result will be indeterminate. a/d control register 2 (1) symbol address after reset adcon2 03d4 16 00 16 b7 b6 b5 b4 b3 b2 b1 b0 a/d conversion method select bit bit symbol bit name function rw smp reserved bit set to 0 0 a/d input group select bit 0 0 : select port p10 group (an i ) 0 1 : select port p9 group (an 3i ) 1 0 : do not set 1 1 : do not set b2 b1 frequency select bit 2 cks2 adgsel0 adgsel1 rw rw rw rw rw (b3) nothing is assigned. when write, set to 0 . when read, its content is 0 . (b7-b6) refer to table 14.2 a/d conversion frequency select rw trg1 trigger select bit 1 0 : without sample and hold 1 : with sample and hold set to "0" in repeat sweep mode 0 0 a/d control register 0 (1) symbol address after reset adcon0 03d6 16 00000xxx 2 b7 b6 b5 b4 b3 b2 b1 b0 analog input pin select bit ch0 bit symbol bit name function ch1 ch2 a/d operation mode select bit 0 md0 md 1 trigger select bit trg adst a/d conversion start flag 0 : a/d conversion disabled 1 : a/d conversion started frequency select bit 0 cks0 rw 1 rw rw rw rw rw rw rw rw refer to table 14.2 a/d conversion frequency select 1 note: 1. if the adcon0 register is rewritten during a/d conversion, the conversion result will be indeterminate. 0 : software trigger 1 : hardware trigger (ad trg trigger) invalid in repeat sweep mode 0 1 1 : repeat sweep mode 0 or repeat sweep mode 1 b4 b3 notes: 1. if the adcon1 register is rewritten during a/d conversion, the conversion result will be indeterminate. 2. an 30 to an 32 can be used in the same way as an 0 to an 7 . use the adgsel1 to adgset0 bits in the adcon2 register to select the desired pin. 3. if the vcut bit is reset from 0 (v ref unconnected) to 1 (v ref connected), wait for 1 figure 14.1.4.2 adcon0 to adcon2 registers in repeat sweep mode 0
14. a/d converter page 194 9 2 3 f o 7 0 0 2 , 5 1 . b e f 0 0 . 2 . v e r 0 0 2 0 - 2 0 2 0 b 9 0 j e r ) t 6 2 / c 6 1 m , b 6 2 / c 6 1 m , a 6 2 / c 6 1 m ( p u o r g a 6 2 / c 6 1 m 14.1.5 repeat sweep mode 1 in repeat sweep mode 1, analog voltages applied to the all selected pins are converted to a digital code, with mainly used in the selected pins. table 14.1.5.1 shows the repeat sweep mode 1 specifications. figure 14.1.5.1 shows the operation example in repeat sweep mode 1. figure 14.1.5.2 shows the adcon0 to adcon2 registers in repeat sweep mode 1. table 14.1.5.1 repeat sweep mode 1 specifications item specification function the scan1 to scan0 bits in the adcon1 register and the adgsel1 to adgsel0 bits in the adcon2 register mainly select pins. analog voltage applied to the all selected pins is repeatedly converted to a digital code example : when selecting an 0 analog voltage is converted to a digital code in the following order an 0 an 1 an 0 an 2 an 0 an 3 , and so on. a/d conversion start condition ? when the trg bit in the adcon0 register is 0 (software trigger) set the adst bit in the adcon0 register to 1 (a/d conversion started) ? when the trg bit in the adcon0 register is 1 (hardware trigger) the ad trg pin input changes state from h to l after setting the adst bit to 1 (a/d conversion started) a/d conversion stop condition set the adst bit to 0 (a/d conversion halted) interrupt request generation timing none generated analog input pins mainly select from an 0 (1 pins), an 0 to an 1 (2 pins), an 0 to an 2 (3 pins), used in a/d conversions an 0 to an 3 (4 pins) (1) readout of a/d conversion result readout one of the ad0 to ad7 registers that corresponds to the selected pin note: 1. an 30 to an 32 can be used in the same way as an 0 to an 7 . however, all input pins need to belong to the same group. figure 14.1.5.1 operation example in repeat sweep mode 1 ? example when selecting an 0 to analog input pins (scan1 to scan0=00 2 ) an 0 an 1 an 2 an 3 an 4 an 5 an 6 an 7 a/d conversion started a/d pin input voltage sampling a/d pin conversion
14. a/d converter page 195 9 2 3 f o 7 0 0 2 , 5 1 . b e f 0 0 . 2 . v e r 0 0 2 0 - 2 0 2 0 b 9 0 j e r ) t 6 2 / c 6 1 m , b 6 2 / c 6 1 m , a 6 2 / c 6 1 m ( p u o r g a 6 2 / c 6 1 m a/d control register 0 (1) symbol address after reset adcon0 03d6 16 00000xxx 2 b7 b6 b5 b4 b3 b2 b1 b0 analog input pin select bit ch0 bit symbol bit name function ch1 ch2 a/d operation mode select bit 0 md0 md 1 trigger select bit trg adst a/d conversion start flag 0 : a/d conversion disabled 1 : a/d conversion started frequency select bit 0 cks0 rw a/d control register 1 (1) symbol address after reset adcon1 03d7 16 00 16 bit name function bit symbol b7 b6 b5 b4 b3 b2 b1 b0 a/d sweep pin select bit (2) scan0 scan1 md 2 bits 8/10-bit mode select bit 0 : 8-bit mode 1 : 10-bit mode vcut v ref connect bit (3) a/d operation mode select bit 1 1 : v ref connected 1 1 1 frequency select bit 1 cks1 1 : repeat sweep mode 1 rw rw rw rw rw rw rw rw rw rw rw rw rw rw rw refer to table 14.2 a/d conversion frequency select refer to table 14.2 a/d conversion frequency select (b7-b6) 1 note: 1. if the adcon2 register is rewritten during a/d conversion, the conversion result will be indeterminate. a/d control register 2 (1) symbol address after reset adcon2 03d4h 00h b7 b6 b5 b4 b3 b2 b1 b0 a/d conversion method select bit bit symbol bit name function rw smp reserved bit set to 0 0 a/d input group select bit 0 0 : select port p10 group (an i ) 0 1 : select port p9 group (an 3i ) 1 0 : do not set 1 1 : do not set b2 b1 frequency select bit 2 cks2 adgsel0 adgsel1 rw rw rw rw rw (b3) nothing is assigned. when write, set to 0 . when read, its content is 0 . (b7-b6) refer to table 14.2 a/d conversion frequency select rw trg1 trigger select bit 1 note: 1. if the adcon0 register is rewritten during a/d conversion, the conversion result will be indeterminate. 0 : software trigger 1 : hardware trigger (ad trg trigger) nothing is assigned. when write, set to 0 . when read, its content is 0 . 0 : without sample and hold 1 : with sample and hold set to "0" in repeat sweep mode 1 invalid in repeat sweep mode 1 1 1 : repeat sweep mode 0 or repeat sweep mode 1 b4 b3 when selecting repeat sweep mode 1 0 0 : an 0 (1 pin) 0 1 : an 0 to an 1 (2 pins) 1 0 : an 0 to an 2 (3 pins) 1 1 : an 0 to an 3 (4 pins) b1 b0 0 notes: 1. if the adcon1 register is rewritten during a/d conversion, the conversion result will be indeterminate. 2. an 30 to an 32 can be used in the same way as an 0 to an 7 . use the adgsel1 to adgsel0 bits in the adcon2 register to select the desired pin. 3. if the vcut bit is reset from 0 (v ref unconnected) to 1 (v ref connected), wait for 1 figure 14.1.5.2 adcon0 to adcon2 registers in repeat sweep mode 1
14. a/d converter page 196 9 2 3 f o 7 0 0 2 , 5 1 . b e f 0 0 . 2 . v e r 0 0 2 0 - 2 0 2 0 b 9 0 j e r ) t 6 2 / c 6 1 m , b 6 2 / c 6 1 m , a 6 2 / c 6 1 m ( p u o r g a 6 2 / c 6 1 m item specification function the scan1 to scan0 bits in the adcon1 register and adgsel1 to adgsel0 bits in the adcon2 register select pins. analog voltage applied to the selected pins is converted one-by-one to a digital code. at this time, the input voltage of an 0 and an 1 are sampled simultaneously. a/d conversion start condition when the trg bit in the adcon0 register is "0" (software trigger) set the adst bit in the adcon0 register to 1 (a/d conversion started) when the trg bit in the adcon0 register is "1" (hardware trigger) the trigger is selected by trg1 and hptrg0 bits (see table 14.1.6.2 ) the ad trg pin input changes state from h to l after setting the adst bit to 1 (a/d conversion started) timer b0, b2 or timer b2 interrupt generation frequency setting counter underflow after setting the adst bit to 1 (a/d conversion started) a/d conversion stop condition a/d conversion completed (if selecting software trigger, the adst bit is automatically set to "0". set the adst bit to "0" (a/d conversion halted) interrupt generation timing a/d conversion completed analog input pin select from an 0 to an 1 (2 pins), an 0 to an 3 (4 pins), an 0 to an 5 (6 pins), or an 0 to an 7 (8 pins) (1) readout of a/d conversion result readout one of the an0 to an7 registers that corresponds to the selected pin note: 1. an 30 to an 32 can be used in the same way as an 0 to an 7 . however, all input pins need to belong to the same group. 14.1.6 simultaneous sample sweep mode in simultaneous sample sweep mode, analog voltages applied to the selected pins are converted one-by- one to a digital code. at this time, the input voltage of an 0 and an 1 are sampled simultaneously using two circuits of sample and hold circuit. table 14.1.6.1 shows the simultaneous sample sweep mode specifica- tions. figure 14.1.6.1 shows the operation example in simultaneous sample sweep mode. figure 14.1.6.2 shows adcon0 to adcon2 registers and figure 14.1.6.3 shows adtrgcon registers in simultaneous sample sweep mode. table 14.1.6.2 shows the trigger select bit setting in simultaneous sample sweep mode. in simultaneous sample sweep mode, timer b0 underflow can be selected as a trigger by combining software trigger, ad trg trigger, timer b2 underflow, timer b2 interrupt generation frequency setting counter underflow or a/d trigger mode of timer b. ? example when selecting an 0 to an 3 to analog input pins (scan1 to scan0=01 2 ) a/d conversion started a/d interrupt request generated an 0 an 1 an 2 an 3 an 4 an 5 an 6 an 7 a/d pin input voltage sampling a/d pin conversion figure 14.1.6.1 operation example in simultaneous sample sweep mode table 14.1.6.1 simultaneous sample sweep mode specifications
14. a/d converter page 197 9 2 3 f o 7 0 0 2 , 5 1 . b e f 0 0 . 2 . v e r 0 0 2 0 - 2 0 2 0 b 9 0 j e r ) t 6 2 / c 6 1 m , b 6 2 / c 6 1 m , a 6 2 / c 6 1 m ( p u o r g a 6 2 / c 6 1 m figure 14.1.6.2 adcon0 to adcon2 registers for simultaneous sample sweep mode a/d control register 0 (1) symbol address after reset adcon0 03d6 16 00000xxx 2 b7 b6 b5 b4 b3 b2 b1 b0 analog input pin select bit ch0 bit symbol bit name function ch1 ch2 a/d operation mode select bit 0 md0 md 1 trigger select bit trg adst a/d conversion start fag 0 : a/d conversion disabled 1 : a/d conversion started frequency select bit 0 cks0 rw a/d control register 1 (1) symbol address after reset adcon1 03d7 16 00 16 bit name function bit symbol b7 b6 b5 b4 b3 b2 b1 b0 a/d sweep pin select bit (2) scan0 scan1 md 2 bits 8/10-bit mode select bit 0 : 8-bit mode 1 : 10-bit mode vcut v ref connect bit (3) a/d operation mode select bit 1 1 : v ref connected 1 0 1 frequency select bit 1 cks1 0 : any mode other than repeat sweep mode 1 rw rw rw rw rw rw rw rw rw rw rw rw rw rw rw refer to table 14.2 a/d conversion frequency select refer to table 14.2 a/d conversion frequency select (b7-b6) 0 note: 1. if the adcon2 register is rewritten during a/d conversion, the conversion result will be indeterminate. a/d control register 2 (1) symbol address after reset adcon2 03d4 16 00 16 b7 b6 b5 b4 b3 b2 b1 b0 a/d conversion method select bit bit symbol bit name function rw smp reserved bit set to 0 0 a/d input group select bit 0 0 : select port p10 group (an i ) 0 1 : select port p9 group (an 3i ) 1 0 : do not set 1 1 : do not set b2 b1 frequency select bit 2 cks2 adgsel0 adgsel1 rw rw rw rw rw (b3) nothing is assigned. when write, set to 0 . when read, its content is 0 . (b7-b6) refer to table 14.2 a/d conversion frequency select rw trg1 trigger select bit 1 note: 1. if the adcon0 register is rewritten during a/d conversion, the conversion result will be indeterminate. refer to table 14.1.6.2 trigger select bit setting in simultaneous sample sweep mode invalid in simultaneous sample sweep mode 1 0 : single sweep mode or simultaneous sample sweep mode b4 b3 when selecting simultaneous sample sweep mode 0 0 : an 0 to an 1 (2 pins) 0 1 : an 0 to an 3 (4 pins) 1 0 : an 0 to an 5 (6 pins) 1 1 : an 0 to an 7 (8 pins) b1 b0 1 refer to table 14.1.6.2 trigger select bit setting in simultaneous sample sweep mode set to 1 in simultaneous sample sweep mode nothing is assigned. when write, set to 0 . when read, its content is 0 . notes: 1. if the adcon1 register is rewritten during a/d conversion, the conversion result will be indeterminate. 2. an 30 to an 32 can be used in the same way as an 0 to an 7 . use the adgsel1 to adgset0 bits in the adcon2 register to select the desired pin. 3. if the vcut bit is reset from 0 (v ref unconnected) to 1 (v ref connected), wait for 1
14. a/d converter page 198 9 2 3 f o 7 0 0 2 , 5 1 . b e f 0 0 . 2 . v e r 0 0 2 0 - 2 0 2 0 b 9 0 j e r ) t 6 2 / c 6 1 m , b 6 2 / c 6 1 m , a 6 2 / c 6 1 m ( p u o r g a 6 2 / c 6 1 m figure 14.1.6.3 adtrgcon register in simultaneous sample sweep mode a/d trigger control register (1) symbol address after reset adtrgcon 03d2 16 00 16 b7 b6 b5 b4 b3 b2 b1 b0 a/d operation mode select bit 2 bit symbol bit name function rw sse a/d operation mode select bit 3 an1 trigger select bit hptrg1 dte hptrg0 rw rw rw rw nothing is assigned. when write, set to 0 . when read, its content is 0 . (b7-b4) an0 trigger select bit note: 1. if adtrgcon register is rewritten during a/d conversion, the conversion result will be indeterminate. 0 0 : any mode other than delayed trigger mode 0,1 1 : simultaneous sample sweep mode or delayed trigger mode 0, 1 1 0 refer to table 14.1.6.2 trigger select bit setting in simultaneous sample sweep mode set to "0" in simultaneous sample sweep mode table 14.1.6.2 trigger select bit setting in simultaneous sample sweep mode trg hptrg0 trg1 trigger 0 1 1 1 - 1 0 0 software trigger timer b0 underflow (1) timer b2 or timer b2 interrupt generation frequency setting counter underflow (2) ad tr g - - 1 0 note: 1. a count can be started for timer b2, timer b2 interrupt generation frequency setting counter underflow or the int5 pin falling edge as count start conditions of timer b0. 2. select timer b2 or timer b2 interrupt generation frequency setting counter using the tb2sel bit in the tb2sc register.
14. a/d converter page 199 9 2 3 f o 7 0 0 2 , 5 1 . b e f 0 0 . 2 . v e r 0 0 2 0 - 2 0 2 0 b 9 0 j e r ) t 6 2 / c 6 1 m , b 6 2 / c 6 1 m , a 6 2 / c 6 1 m ( p u o r g a 6 2 / c 6 1 m item specification function the scan1 to scan0 bits in the adcon1 register and adgsel1 to adgsel0 bits in the adcon2 register select pins. analog voltage applied to the input voltage of the selected pins are converted one-by-one to the digital code. at this time, timer b0 under flow generation starts an 0 pin conversion. timer b1 underflow generation starts con version after the an 1 pin. (1) a/d conversion start an 0 pin conversion start condition ? when timer b0 underflow is generated if timer b0 underflow is generated again before timer b1 underflow is generated , the conversion is not affected ? when timer b0 underflow is generated during a/d conversion of pins after the an 1 pin, conversion is halted and the sweep is restarted from an 0 pin an 1 pin conversion start condition ? when timer b1 underflow is generated during a/d conversion of the an 0 pin, the input voltage of the an 1 pin is sampled. the an 1 conversion and the rest of the sweep start when an 0 conversion is completed. a/d conversion stop ? when single sweep conversion from the an 0 pin is completed condition ? set the adst bit to "0" (a/d conversion halted) (2) interrupt request a/d conversion completed generation timing analog input pin select from an 0 to an 1 (2 pins), an 0 to an 3 (4 pins), an 0 to an 5 (6 pins) and an 0 to an 7 (8 pins) (3) readout of a/d conversion result readout one of the an0 to an7 registers that corresponds to the selected pins notes: 1. set the larger value than the value of the timer b0 register to the timer b1 register. 2. do not write 1 (a/d conversion started) to the adst bit in delayed trigger mode 0. when write 1 , unexpected interrupts may be generated. 3. an 30 to an 32 can be used in the same way as an 0 to an 7 . however, all input pins need to belong to the same group. 14.1.7 delayed trigger mode 0 in delayed trigger mode 0, analog voltages applied to the selected pins are converted one-by-one to a digital code. the delayed trigger mode 0 used in combination with a/d trigger mode of timer b. the timer b0 underflow starts a single sweep conversion. after completing the an 0 pin conversion, the an 1 pin is not sampled and converted until the timer b1 underflow is generated. when the timer b1 under- flow is generated, the single sweep conversion is restarted with the an 1 pin. table 14.1.7.1 shows the delayed trigger mode 0 specifications. figure 14.1.7.1 shows the operation example in delayed trigger mode 0. figure 14.1.7.2 and figure 14.1.7.3 show each flag operation in the adstat0 register that corresponds to the operation example. figure 14.1.7.4 shows the adcon0 to adcon2 registers in delayed trigger mode 0. figure 14.1.7.5 shows the adtrgcon register in delayed trigger mode 0 and table 14.1.7.2 shows the trigger select bit setting in delayed trigger mode 0. table 14.1.7.1 delayed trigger mode 0 specifications
14. a/d converter page 200 9 2 3 f o 7 0 0 2 , 5 1 . b e f 0 0 . 2 . v e r 0 0 2 0 - 2 0 2 0 b 9 0 j e r ) t 6 2 / c 6 1 m , b 6 2 / c 6 1 m , a 6 2 / c 6 1 m ( p u o r g a 6 2 / c 6 1 m an 0 an 1 an 2 an 3 timer b0 underflow a/d pin input voltage sampling a/d pin conversion an 0 an 1 an 2 an 3 timrt b0 underflow (an interrupt does not affect a/d conversion) timer b0 underflow timer b1 underflow timer b1 underflow ? example when selecting an 0 to an 3 to analog input pins (scan1 to scan0=01 2 ) example 1: when timer b1 underflow is generated during an 0 pin conversion an 0 an 1 an 2 an 3 timer b0 underflow timer b1 underflow example 2: when timer b1 underflow is generated after an 0 pin conversion an 0 an 1 an 2 an 3 timer b0 underflow (abort othrt pins conversion) timer b0 underflow timer b1 under flow timer b1 underflow example 3: when timer b0 underflow is generated during a/d conversion of any pins except an 0 pin example 4: when timer b0 underflow is generated again before timer b1 underflow is generated after timer b0 underflow generation figure 14.1.7.1 operation example in delayed trigger mode 0
14. a/d converter page 201 9 2 3 f o 7 0 0 2 , 5 1 . b e f 0 0 . 2 . v e r 0 0 2 0 - 2 0 2 0 b 9 0 j e r ) t 6 2 / c 6 1 m , b 6 2 / c 6 1 m , a 6 2 / c 6 1 m ( p u o r g a 6 2 / c 6 1 m figure 14.1.7.2 each flag operation in adstat0 register associated with the operation example in delayed trigger mode 0 (1) an 0 an 1 an 2 an 3 timer b0 underflow "1" "0" "1" "0" "1" "0" "1" "0" "1" "0" "1" "0" "1" "0" "1" "0" "1" "0" an 0 an 1 an 2 an 3 "1" "0" "1" "0" "1" "0" "1" "0" "1" "0" "1" "0" "1" "0" "1" "0" "1" "0" a/d pin input voltage sampling a/d pin conversion do not set to "1" by program do not set to "1" by program set to "0" by an interrupt request acknowledgement or a program set to "0" by an interrupt request acknowledgement or a program set to 0" by program set to "0" by program adst flag: bit 6 in the adcon0 register aderr0, aderr1, adtcsf, adstt0, adstt1, adstrt0 and adstrt1 flag: bits 0, 1, 3, 4, 5, 6 and 7 in the adstat0 register adst flag aderr0 flag aderr1 flag adtcsf flag adstt0 flag adstt1 flag adstrt0 flag adstrt1 flag ir bit in the adic register adst flag aderr0 flag aderr1 flag adtcsf flag adstt0 flag adstt1 flag adstrt0 flag adstrt1 flag ir bit in the adic register timer b0 underflow timer b1 underflow timer b1 underflow ? example when selecting an 0 to an 3 to analog input pins (scan1 to scan0=01 2 ) example 1: when timer b1 underflow is generated during an 0 pin conversion example 2: when timer b1 underflow is generated after an 0 pin conversion
14. a/d converter page 202 9 2 3 f o 7 0 0 2 , 5 1 . b e f 0 0 . 2 . v e r 0 0 2 0 - 2 0 2 0 b 9 0 j e r ) t 6 2 / c 6 1 m , b 6 2 / c 6 1 m , a 6 2 / c 6 1 m ( p u o r g a 6 2 / c 6 1 m an 0 an 1 an 2 an 3 timer b0 underflow (abort othrt pins conversion ) "1" "0" "1" "0" "1" "0" "1" "0" "1" "0" "1" "0" "1" "0" "1" "0" "1" "0" a/d pin input voltage sampling a/d pin conversion do not set to "1" by program set to "0" by interrupt request acknowledgement or a program set to "0" by program adst flag: bit 6 in the adcon0 register aderr0, aderr1, adtcsf, adstt0, adstt1, adstrt0 and adstrt1 flag: bits 0, 1, 3, 4, 5, 6 and 7 in the adstat0 register adst flag aderr0 flag aderr1 flag adtcsf flag adstt0 flag adstt1 flag adstrt0 flag adstrt1 flag ir bit in the adic register timer b0 underflow timer b1 underflow timer b1 underflow example 3: when timer b0 underflow is generated during a/d pin conversion of any pins except an 0 pin an 0 an 1 an 2 an 3 timrt b0 underflow (an interrupt does not affect a/d conversion) "1" "0" "1" "0" "1" "0" - "1" "0" "1" "0" "1" "0" "1" "0" "1" "0" do not set to "1" by program set to "0" by interrupt request acknowledgement or a program set to "0" by program adst flag aderr0 flag aderr1 flag adtcsf flag adstt0 flag adstt1 flag adstrt0 flag adstrt1 flag ir bit in the adic register timer b0 underflow timer b1 underflow example 4: after timer b0 underflow is generated and when timer b0 underflow is generated again before timer b1 underflow is genetaed figure 14.1.7.3 each flag operation in adstat0 register associated with the operation example in delayed trigger mode 0 (2)
14. a/d converter page 203 9 2 3 f o 7 0 0 2 , 5 1 . b e f 0 0 . 2 . v e r 0 0 2 0 - 2 0 2 0 b 9 0 j e r ) t 6 2 / c 6 1 m , b 6 2 / c 6 1 m , a 6 2 / c 6 1 m ( p u o r g a 6 2 / c 6 1 m figure 14.1.7.4 adcon0 to adcon2 registers in delayed trigger mode 0 a/d control register 0 (1) symbol address after reset adcon0 03d6 16 00000xxx 2 b7 b6 b5 b4 b3 b2 b1 b0 analog input pin select bit ch0 bit symbol bit name function ch1 ch2 a/d operation mode select bit 0 md0 md 1 trigger select bit refer to table 14.1.7.2 trigger select bit setting in delayed trigger mode 0 trg adst a/d conversion start flag (2) 0 : a/d conversion disabled 1 : a/d conversion started frequency select bit 0 cks0 rw a/d control register 1 (1) symbol address after reset adcon1 03d7 16 00 16 bit name function bit symbol b7 b6 b5 b4 b3 b2 b1 b0 a/d sweep pin select bit (2) scan0 scan1 md 2 bits 8/10-bit mode select bit 0 : 8-bit mode 1 : 10-bit mode vcut v ref connect bit (3) a/d operation mode select bit 1 1 : v ref connected 01 when selecting delayed trigger sweep mode 0 0 1 1 1 : set to "111b" in delayed trigger mode 0 b2 b1 b0 0 0 : one-shot mode or delayed trigger mode 0,1 b4 b3 1 frequency select bit 1 cks1 0 : any mode other than repeat sweep mode 1 rw rw rw rw rw rw rw rw rw rw rw rw rw rw rw refer to table 14.2 a/d conversion frequency select refer to table 14.2 a/d conversion frequency select (b7-b6) 1 1 0 b1 b0 0 0: an 0 to an 1 (2 pins) 0 1: an 0 to an 3 (4 pins) 1 0: an 0 to an 5 (6 pins) 1 1: an 0 to an 7 (8 pins) a/d control register 2 (1) symbol address after reset adcon2 03d4 16 00 16 b7 b6 b5 b4 b3 b2 b1 b0 a/d conversion method select bit (2) 1 : with sample and hold bit symbol bit name function rw smp reserved bit set to 0 0 a/d input group select bit 0 0 : select port p10 group (an i ) 0 1 : select port p9 group (an 3i ) 1 0 : do not set 1 1 : do not set b2 b1 frequency select bit 2 cks2 adgsel0 adgsel1 rw rw rw rw rw (b3) nothing is assigned. when write, set to 0 . when read, its content is 0 . (b7-b6) refer to table 14.2 a/d conversion frequency select rw trg1 trigger select bit 1 1 refer to table 14.1.7.2 trigger select bit setting in delayed trigger mode 0 nothing is assigned. when write, set to 0 . when read, its content is 0 . 0 0 notes: 1. if the adcon1 register is rewritten during a/d conversion, the conversion result will be indeterminate. 2. an 30 to an 32 can be used in the same way as an 0 to an 7 . use the adgsel1 to adgsel0 bits in the adcon2 register to select the desired pin. 3. if the vcut bit is reset from 0 (v ref unconnected) to 1 (v ref connected), wait for 1 1 in delayed trigger mode 0. when write, set to "0". notes: 1. if the adcon2 register is rewritten during a/d conversion, the conversion result will be indeterminate. 2. set to 1 in delayed trigger mode 0.
14. a/d converter page 204 9 2 3 f o 7 0 0 2 , 5 1 . b e f 0 0 . 2 . v e r 0 0 2 0 - 2 0 2 0 b 9 0 j e r ) t 6 2 / c 6 1 m , b 6 2 / c 6 1 m , a 6 2 / c 6 1 m ( p u o r g a 6 2 / c 6 1 m figure 14.1.7.5 adtrgcon register in delayed trigger mode 0 a/d trigger control register (1) symbol address after reset adtrgcon 03d2 16 00 16 b7 b6 b5 b4 b3 b2 b1 b0 a/d operation mode select bit 2 bit symbol bit name function r w sse a/d operation mode select bit 3 an1 trigger select bit hptrg1 dte hptrg0 rw rw rw rw nothing is assigned. when write, set to 0 . when read, its content is 0 . (b7-b4) an0 trigger select bit note: 1. if adtrgcon reigster is rewritten during a/d conversion, the conversion result will be indeterminate. 1 delayed trigger mode 0, 1 simultaneous sample sweep mode or delayed trigger mode 0,1 1 refer to table 14.1.7.2 trigger select bit setting in delayed trigger mode 0 refer to table 14.1.7.2 trigger select bit setting in delayed trigger mode 0 1 1 trigger timer b0, b1 underflow trg 0 hptrg0 1 trg1 0 hptrg1 1 table 14.1.7.2 trigger select bit setting in delayed trigger mode 0
14. a/d converter page 205 9 2 3 f o 7 0 0 2 , 5 1 . b e f 0 0 . 2 . v e r 0 0 2 0 - 2 0 2 0 b 9 0 j e r ) t 6 2 / c 6 1 m , b 6 2 / c 6 1 m , a 6 2 / c 6 1 m ( p u o r g a 6 2 / c 6 1 m 14.1.8 delayed trigger mode 1 in delayed trigger mode 1, analog voltages applied to the selected pins are converted one-by-one to a digital code. when the input of the ad trg pin (falling edge) changes state from h to l , a single sweep conversion is started. after completing the an 0 pin conversion, the an 1 pin is not sampled and converted until the second ad trg pin falling edge is generated. when the second ad trg falling edge is generated, the single sweep conversion of the pins after the an 1 pin is restarted. table 14.1.8.1 shows the delayed trigger mode 1 specifications. figure 14.1.8.1 shows the operation example of delayed trigger mode 1. figure 14.1.8.2 to figure 14.1.8.3 show each flag operation in the adstat0 register that corresponds to the operation example. figure 14.1.8.4 shows the adcon0 to adcon2 registers in delayed trigger mode 1. figure 14.1.8.5 shows the adtrgcon register in delayed trigger mode 1 and table 15.1.8.2 shows the trigger select bit setting in delayed trigger mode 1. table 14.1.8.1 delayed trigger mode 1 specifications item specification function the scan1 to scan0 bits in the adcon1 register and adgsel1 to adgsel0 bits in the adcon2 register select pins. analog voltages applied to the selected pins are converted one-by-one to a digital code. at this time, the ad trg pin falling edge starts an 0 pin conversion and the second ad trg pin falling edge starts conversion of the pins after an 1 pin a/d conversion start an 0 pin conversion start condition condition the ad trg pin input changes state from h to l (falling edge) (1) an 1 pin conversion start condition (2) the ad trg pin input changes state from h to l (falling edge) ? when the second ad trg pin falling edge is generated during or after a/d conversion of the an 0 pin, input voltage of an 1 pin is sampled at the time of ad trg falling edge. the conversion of an 1 and the rest of the sweep starts when an 0 conversion is completed. ? when the ad trg pin falling edge is generated again during single sweep conver sion of pins after the an 1 pin, the conversion is not affected a/d conversion stop ? a/d conversion completed condition ? set the adst bit to "0" (a/d conversion halted) (3) interrupt request single sweep conversion completed generation timing analog input pin select from an 0 to an 1 (2 pins), an 0 to an 3 (4 pins), an 0 to an 5 (6 pins) and an 0 to an 7 (8 pins) (4) readout of a/d conversion result readout one of the an0 to an7 registers that corresponds to the selected pins notes: ___________ 1. do not generate the next ad trg pin falling edge after the an1 pin conversion is started until all selected pins ___________ complete a/d conversion. when an ad trg pin falling edge is generated again during a/d conversion, its trigger ___________ is ignored. the falling edge of ad trg pin, which was input after all selected pins complete a/d conversion, is considered to be the next an0 pin conversion start condition. ___________ ___________ 2. the ad trg pin falling edge is detected synchronized with the operation clock 1 (a/d conversion started) to the adst bit in delayed trigger mode 1. when write 1 , unexpected interrupts may be generated. 4. an 30 to an 32 can be used in the same way as an 0 to an 7 . however, all input pins need to belong to the same group.
14. a/d converter page 206 9 2 3 f o 7 0 0 2 , 5 1 . b e f 0 0 . 2 . v e r 0 0 2 0 - 2 0 2 0 b 9 0 j e r ) t 6 2 / c 6 1 m , b 6 2 / c 6 1 m , a 6 2 / c 6 1 m ( p u o r g a 6 2 / c 6 1 m ? example when selecting an 0 to an 3 to analog input pins (scan1 to scan0=01 2 ) a/d pin input voltage sampling a/d pin conversion an 0 an 1 an 2 an 3 ad trg pin input example 1: when ad trg pin falling edge is generated during an 0 pin conversion an 0 an 1 an 2 an 3 example 2: when ad trg pin falling edge is generated again after an 0 pin conversion ad trg pin input example 3: when ad trg pin falling edge is generated more than two times after an 0 pin conversion an 0 an 1 an 2 an 3 (invalid) (valid after single sweep conversion) ad trg pin input figure 14.1.8.1 operation example in delayed trigger mode1
14. a/d converter page 207 9 2 3 f o 7 0 0 2 , 5 1 . b e f 0 0 . 2 . v e r 0 0 2 0 - 2 0 2 0 b 9 0 j e r ) t 6 2 / c 6 1 m , b 6 2 / c 6 1 m , a 6 2 / c 6 1 m ( p u o r g a 6 2 / c 6 1 m ? example when selecting an 0 to an 3 to analog input pins (scan1 to scan0=01 2 ) a/d pin input voltage sampling a/d pin conversion an 0 an 1 an 2 an 3 an 0 an 1 an 2 an 3 example 2: when ad trg pin falling edge is generated again after an 0 pin conversion ad trg pin input example 1: when ad trg pin falling edge is generated during an 0 pin conversion adst flag aderr0 flag aderr1 flag adtcsf flag adstt0 flag adstt1 flag adstrt0 flag adstrt1 flag ir bit in the adic register "1" "0" "1" "0" "1" "0" "1" "0" "1" "0" "1" "0" "1" "0" "1" "0" "1" "0" set to "0" by interrupt request acknowledgement or a program adst flag aderr0 flag aderr1 flag adtcsf flag adstt0 flag adstt1 flag adstrt0 flag adstrt1 flag ir bit in the adic register "1" "0" "1" "0" "1" "0" "1" "0" "1" "0" "1" "0" "1" "0" "1" "0" "1" "0" adst flag: bit 6 in the adcon0 register aderr0, aderr1, adtcsf, adstt0, adstt1, adstrt0 and adstrt1 flag: bits 0, 1, 3, 4, 5, 6 and 7 in the adstat0 register set to "0" by program set to "0" by interrupt request acknowledgment or a program set to "0" by program do not set to "1" by program do not set to "1" by program ad trg pin input figure 14.1.8.2 each flag operation in adstat0 register associated with the operation example in delayed trigger mode 1 (1)
14. a/d converter page 208 9 2 3 f o 7 0 0 2 , 5 1 . b e f 0 0 . 2 . v e r 0 0 2 0 - 2 0 2 0 b 9 0 j e r ) t 6 2 / c 6 1 m , b 6 2 / c 6 1 m , a 6 2 / c 6 1 m ( p u o r g a 6 2 / c 6 1 m example 3: when ad trg input falling edge is generated more than two times after an 0 pin conversion an 0 an 1 an 2 an 3 (invalid) (valid after single sweep conversion) adst flag aderr0 flag aderr1 flag adtcsf flag adstt0 flag adstt1 flag adstrt0 flag adstrt1 flag ir bit in the adic register "1" "0" "1" "0" "1" "0" "1" "0" "1" "0" "1" "0" "1" "0" "1" "0" "1" "0" set to "0" when interrupt request acknowledgement or a program set to "0" by program do not set to "1" by program a/d pin input voltage sampling a/d pin conversion adst flag: bit 6 in the adcon0 register aderr0, aderr1, adtcsf, adstt0, adstt1, adstrt0 and adstrt1 flag: bits 0, 1, 3, 4, 5, 6 and 7 in the adstat0 register ad trg pin input figure 14.1.8.2 each flag operation in adstat0 register associated with the operation example in delayed trigger mode 1 (2)
14. a/d converter page 209 9 2 3 f o 7 0 0 2 , 5 1 . b e f 0 0 . 2 . v e r 0 0 2 0 - 2 0 2 0 b 9 0 j e r ) t 6 2 / c 6 1 m , b 6 2 / c 6 1 m , a 6 2 / c 6 1 m ( p u o r g a 6 2 / c 6 1 m a/d control register 0 (1) symbol address after reset adcon0 03d6 16 00000xxx 2 b7 b6 b5 b4 b3 b2 b1 b0 analog input pin select bit ch0 bit symbol bit name functio n ch1 ch2 a/d operation mode select bit 0 md0 md1 trigger select bit refer to table 14.1.8.2 trigger select bit setting in delayed trigger mode 1 trg adst a/d conversion start flag (2) 0 : a/d conversion disabled 1 : a/d conversion started frequency select bit 0 cks0 rw a/d control register 1 (1) symbol address after reset adcon1 03d7 16 00 16 bit name function bit symbol b7 b6 b5 b4 b3 b2 b1 b0 a/d sweep pin select bit (2) scan0 scan1 md2 bits 8/10-bit mode select bit 0 : 8-bit mode 1 : 10-bit mode vcut v ref connect bit (3) a/d operation mode select bit 1 1 : v ref connected 01 when selecting delayed trigger mode 1 0 1 1 1 : set to "111b" in delayed trigger mode 1 b2 b1 b0 0 0 : one-shot mode or delayed trigger mode 0,1 b4 b3 1 frequency select bit 1 cks1 0 : any mode other than repeat sweep mode 1 rw rw rw rw rw rw rw rw rw rw rw rw rw rw rw refer to table 14.2 a/d conversion frequency select refer to table 14.2 a/d conversion frequency select (b7-b6) 1 1 0 b1 b0 0 0: an 0 to an 1 (2 pins) 0 1: an 0 to an 3 (4 pins) 1 0: an 0 to an 5 (6 pins) 1 1: an 0 to an 7 (8 pins) nothing is assigned. when write, set to 0 . when read, its content is 0 . 0 notes: 1. if the adcon0 register is rewritten during a/d conversion, the conversion result will be indeterminate. 2. do not write 1 in delayed trigger mode 1. when write, set to "0". notes: 1. if the adcon1 register is rewritten during a/d conversion, the conversion result will be indeterminate. 2. an 30 to an 32 can be used in the same way as an 0 to an 7 . use the adgsel1 to adgset0 bits in the adcon2 register to select the desired pin. 3. if the vcut bit is reset from 0 (v ref unconnected) to 1 (v ref connected), wait for 1 0 0 a/d input group select bi t 0 0 : select port p10 group (an i ) 0 1 : select port p9 group (an 3i ) 1 0 : do not set 1 1 : do not set b2 b1 frequency select bit 2 cks2 adgsel0 adgsel1 rw rw rw rw rw (b3) nothing is assigned. when write, set to 0 . when read, its content is 0 . (b7-b6) refer to table 14.2 a/d conversion frequency select rw trg1 trigger select bit 1 1 refer to table 14.1.8.2 trigger select bit setting in delayed trigger mode 1 1 notes: 1. if the adcon2 register is rewritten during a/d conversion, the conversion result will be indeterminate. 2. set to 1 in delayed trigger mode 1. figure 14.1.8.4 adcon0 to adcon2 registers in delayed trigger mode 1
14. a/d converter page 210 9 2 3 f o 7 0 0 2 , 5 1 . b e f 0 0 . 2 . v e r 0 0 2 0 - 2 0 2 0 b 9 0 j e r ) t 6 2 / c 6 1 m , b 6 2 / c 6 1 m , a 6 2 / c 6 1 m ( p u o r g a 6 2 / c 6 1 m a/d trigger control register (1) symbol address after reset adtrgcon 03d2 16 00 16 b7 b6 b5 b4 b3 b2 b1 b0 a/d operation mode select bit 2 bit symbol bit name function rw sse a/d operation mode select bit 3 an1 trigger select bit hptrg1 dte hptrg0 rw rw rw rw nothing is assigned. when write, set to 0 . when read, its content is 0 . (b7-b4) an0 trigger select bit note: 1. if adtrgcon is rewritten during a/d conversion, the conversion result will be indeterminate. 1 delayed trigger mode 0, 1 simultaneous sample sweep mode or delayed trigger mode 0,1 1 0 refer to table 14.1.8.2 trigger select bit setting in delayed trigger mode 1 refer to table 14.1.8.2 trigger select bit setting in delayed trigger mode 1 0 figure 14.1.8.5 adtrgcon register in delayed trigger mode 1 trigger trg 0 hptrg0 0 trg1 1 ad trg hptrg1 0 table 14.1.8.2 trigger select bit setting in delayed trigger mode 1
14. a/d converter page 211 9 2 3 f o 7 0 0 2 , 5 1 . b e f 0 0 . 2 . v e r 0 0 2 0 - 2 0 2 0 b 9 0 j e r ) t 6 2 / c 6 1 m , b 6 2 / c 6 1 m , a 6 2 / c 6 1 m ( p u o r g a 6 2 / c 6 1 m 14.2 resolution select function the bits bit in the adcon1 register determines the resolution. when the bits bit is set to 1 (10-bit precision), the a/d conversion result is stored into bits 0 to 9 in the a/d register i (i=0 to 7). when the bits bit is set to 0 (8-bit precision), the a/d conversion result is stored into bits 0 to 7 in the adi register. 14.3 sample and hold when the smp bit in the adcon 2 register is set to 1 (with the sample and hold function), a/d conver- sion rate per pin increases to 28 14.4 power consumption reducing function when the a/d converter is not used, the vcut bit in the adcon1 register isolates the resistor ladder of the a/d converter from the reference voltage input pin (v ref ). power consumption is reduced by shutting off any current flow into the resistor ladder from the v ref pin. when using the a/d converter, set the vcut bit to 1 (v ref connected) before setting the adst bit in the adcon0 register to 1 (a/d conversion started). do not set the adst bit and vcut bit to 1 simulta- neously, nor set the vcut bit to 0 (v ref unconnected) during a/d conversion.
14. a/d converter page 212 9 2 3 f o 7 0 0 2 , 5 1 . b e f 0 0 . 2 . v e r 0 0 2 0 - 2 0 2 0 b 9 0 j e r ) t 6 2 / c 6 1 m , b 6 2 / c 6 1 m , a 6 2 / c 6 1 m ( p u o r g a 6 2 / c 6 1 m 14.5 output impedance of sensor under a/d conversion to carry out a/d conversion properly, charging the internal capacitor c shown in figure 14.5.1 has to be completed within a specified period of time. t (sampling time) as the specified time. let output imped- ance of sensor equivalent circuit be r0, microcomputer s internal resistance be r, precision (error) of the a/d converter be x, and the a/d converter s resolution be y (y is 1024 in the 10-bit mode, and 256 in the 8-bit mode). vc is generally vc = vin{1-e c(r0+r) } and when t = t, vc=vin- vin=vin(1- ) e c(r0+r) = - t = ln hence, r0 = - - r figure 14.5.1 shows analog input pin and externalsensor equivalent circuit. when the difference be- tween vin and vc becomes 0.1lsb, we find impedance r0 when voltage between pins. vc changes from 0 to vin-(0.1/1024) vin in timer t. (0.1/1024) means that a/d precision drop due to insufficient capacitor chage is held to 0.1lsb at time of a/d conversion in the 10-bit mode. actual error however is the value of absolute precision added to 0.1lsb. when f(xin) = 10mhz, t=0.3 ? ? ? figure 14.5.1 analog input pin and external sensor equivalent circuit 1 1 t t c(r0+r) 1 x y x y x y x y t c ? ln x y 1.5x10 -12 ? ln 0.1 1024 0.3x10 -6 r 0 r (7.8k ?
15. crc calculation circuit page 213 9 2 3 f o 7 0 0 2 , 5 1 . b e f 0 0 . 2 . v e r 0 0 2 0 - 2 0 2 0 b 9 0 j e r ) t 6 2 / c 6 1 m , b 6 2 / c 6 1 m , a 6 2 / c 6 1 m ( p u o r g a 6 2 / c 6 1 m 15. crc calculation circuit the cyclic redundancy check (crc) operation detects an error in data blocks. the microcomputer uses a generator polynomial of crc_ccitt (x 16 + x 12 + x 5 + 1) or crc-16 (x 16 + x 15 + x 2 + 1) to generate crc code. the crc code is a 16-bit code generated for a block of a given data length in multiples of bytes. the code is updated in the crc data register everytime one byte of data is transferred to a crc input register. the data register needs to be initialized before use. generation of crc code for one byte of data is completed in two machine cycles. figure 15.1 shows the block diagram of the crc circuit. figure 15.2 shows the crc-related registers. figure 15.3 shows the calculation example using the crc_ccitt operation. 15.1. crc snoop the crc circuit includes the ability to snoop reads and writes to certain sfr addresses. this can be used to accumulate the crc value on a stream of data without using extra bandwidth to explicitly write data into the crcin register. all sfr addresses after 0020 16 are subject to the crc snoop. the crc snoop is useful to snoop the writes to a uart tx buffer, or the reads from a uart rx buffer. to snoop an sfr address, the target address is written to the crc snoop address register (bits 9 to 0 in the crcsar register). the two most significant bits in this register enable snooping on reads or writes to the target address. if the target sfr is written to by the cpu or dma, and the crc snoop write bit is set (the crcsw bit is set to "1"), the crc will latch the data into the crcin register. the new crc code will be set in the crcd register. similarly, if the target sfr is read by the crc or dma, and the crc snoop read bit is set (the crcsr bit is set to "1"), the crc will latch the data from the target into the crcin register and calculate the crc. the crc circuit can only calculate crc codes on data byte at a time. therefore, if a target sfr is accessed in a word (16 bit) bus cycle, only the byte of data going to or from the target snooped into crcin, the other byte of the word access is ignored. figure 15.1 crc circuit block diagram aaaaa eight low-order bits aaaaa eight high-order bits data bus high-order data bus low-order aaaaaaaaaa aaaaaaaaaa aaaaa aaaaa crcd register (16) crc input register (8) aaaaaaaaaa a aaaaaaaa a aaaaaaaaaa crc code generating circuit x 16 + x 12 + x 5 + 1 or x 16 + x 15 + x 2 + 1 address bus snoopb lock snoop enable snoop address aaaaaaaa aaaaaaaa aaaaaaaa aaaaaaaa aaaaaaaa aaaaaaaa aaaaaaaa aaaaaaaa equal? (address 03bd 16 , 03bc 16 ) (address 03be 16 )
15. crc calculation circuit page 214 9 2 3 f o 7 0 0 2 , 5 1 . b e f 0 0 . 2 . v e r 0 0 2 0 - 2 0 2 0 b 9 0 j e r ) t 6 2 / c 6 1 m , b 6 2 / c 6 1 m , a 6 2 / c 6 1 m ( p u o r g a 6 2 / c 6 1 m symbol address after reset crcd 03bd 16 to 03bc 16 undefined b7 b0 b7 b0 (b15) (b8) crc data register function setting range 0000 16 to ffff 16 rw rw symbol address after reset crcin 03be 16 undefined b7 b0 crc input register data input function 00 16 to ff 16 rw rw setting range crc calculation result output symbol address after reset crcmr 03b6 16 0xxxxxx0 2 b7 b0 crc mode register crc mode polynomial selection bit function 0: lsb first 1: msb first rw rw bit name bit symbol crc mode selection bit crcps crcms rw nothing is assigned. write "0" when writing to this bit. the value is indeterminate if read. 0: x 16 +x 12 +x 5 +1 (crc-ccitt) 1: x 16 +x 15 +x 2 +1 (crc-16) crc mode polynomial selection bit function 0: lsb first 1: msb first rw rw bit name bit symbol crc mode selection bit crcps crcms rw nothing is assigned. if necessary, set to 0. when read, the content is undefined 0: x 16 +x 12 +x 5 +1 (crc-ccitt) 1: x 16 +x 15 +x 2 +1 (crc-16) (b6-b1) symbol address after reset crcsar 03b5 16 to 03b4 16 00xxxxxx xxxxxxxx 2 b7 b0 b7 b0 (b15) (b8) sfr snoop address register crc mode polynomial selection bit function rw rw bit name bit symbol crcsr rw nothing is assigned. if necessary, set to 0. when read, the content is undefined sfr address to snoop function 0: disabled 1: enabled (1) rw crcsw crcsar9-0 crc snoop on read enable bit crc snoop on write enable bit 0: disabled 1: enabled (1) rw (b13-b10) note: 1. set bits crcsr and crcsw to 0 if the plc07 bit in the plc0 register is set to 1 (pll on) and the pm20 bit in the pm2 register is set to 0 (sfr access 2 wait). figure 15.2. crcd, crcin, crcmr, crcsar register
15. crc calculation circuit page 215 9 2 3 f o 7 0 0 2 , 5 1 . b e f 0 0 . 2 . v e r 0 0 2 0 - 2 0 2 0 b 9 0 j e r ) t 6 2 / c 6 1 m , b 6 2 / c 6 1 m , a 6 2 / c 6 1 m ( p u o r g a 6 2 / c 6 1 m figure 15.3. crc calculation (1) setting 0000 16 (initial value) b15 b0 1 0001 0000 0010 0001 1000 0000 0000 0000 0000 0000 1000 1000 0001 0000 1 1000 0001 0000 1000 0 1000 1000 0001 0000 1 1001 0001 1000 1000 1000 1000 msb modulo-2 operation is operation that complies with the law given below. 0 + 0 = 0 0 + 1 = 1 1 + 0 = 1 1 + 1 = 0 -1 = 1 the code resulting from sending 01 16 in lsb first mode is (10000 0000).this the crc code in the generating polynomial, (x 16 + x 12 + x 5 + 1), becomes the remainder resulting from dividing(1000 0000)x 16 by ( 1 0001 0000 0010 0001) in conformity with the modulo-2 operation. (2) setting 01 16 b0 b7 b15 b0 1189 16 2 cycles after crc calculation is complete thus the crc code becomes ( 1001 0001 1000 1000). since the operation is in lsb first mode, the (1001 0001 1000 1000) corresponds to 1189 16 in hexadecimal notation. if the crc operation in msb first mode is necessary, set the crc mode selection bit to "1". crc data register stores crc code for msb first mode. crd data register crcd [03bd 16 , 03bc 16 ] crc input register crcin [03be 16 ] crd data register crcd [03bd 16 , 03bc 16 ] crc input register crcin [03be 16 ] (3) setting 23 16 b0 b7 b15 b0 0a41 16 after crc calculation is complete crd data register crcd [03bd 16 , 03bc 16 ] 98 11 msb lsb lsb stores crc code stores crc code
16. programmable i/o ports page 216 9 2 3 f o 7 0 0 2 , 5 1 . b e f 0 0 . 2 . v e r 0 0 2 0 - 2 0 2 0 b 9 0 j e r ) t 6 2 / c 6 1 m , b 6 2 / c 6 1 m , a 6 2 / c 6 1 m ( p u o r g a 6 2 / c 6 1 m 16. programmable i/o ports note p6 0 to p6 3 , p9 2 and p9 3 are not available in the 42-pin package. the programmable input/output ports (hereafter referred to simply as i/o ports ) consist of 39 lines p1 5 to p1 7 , p6, p7, p8, p9 0 to p9 3 , p10 for the 48-pin package, or 33 lines p1 5 to p1 7 , p6 4 to p6 7 , p7, p8, p9 0 to p9 1 , p10 for the 42-pin package. each port can be set for input or output every line by using a direction register, and can also be chosen to be or not be pulled high in sets of 4 lines. figures 16.1 to 16.4 show the i/o ports. figure 16.5 shows the i/o pins. each pin functions as an i/o port, a peripheral function input/output. for details on how to set peripheral functions, refer to each functional description in this manual. if any pin is used as a peripheral function input, set the direction bit for that pin to 0 (input mode). any pin used as an output pin for peripheral functions is directed for output no matter how the corresponding direction bit is set. 16.1 port pi direction register (pdi register, i = 1, 6 to 10) figure 16.1.1 shows the direction registers. this register selects whether the i/o port is to be used for input or output. the bits in this register corre- spond one for one to each port. 16.2 port pi register (pi register, i = 1, 6 to 10) figure 16.2.1 shows the pi registers. data input/output to and from external devices are accomplished by reading and writing to the pi register. the pi register consists of a port latch to hold the output data and a circuit to read the pin status. for ports set for input mode, the input level of the pin can be read by reading the corresponding pi register, and data can be written to the port latch by writing to the pi register. for ports set for output mode, the port latch can be read by reading the corresponding pi register, and data can be written to the port latch by writing to the pi register. the data written to the port latch is output from the pin. the bits in the pi register correspond one for one to each port. 16.3 pull-up control register 0 to pull-up control register 2 (pur0 to pur2 registers) figure 16.3.1 shows the pur0 to pur2 registers. the pur0 to pur2 registers select whether the ports, divided into groups of four ports, are pulled up or not. the ports, selected by setting the bits in registers pur2 to pur0 to 1 (pull-up), are pulled up when the direction registers are set to 0 (input mode). the ports are pulled up regardless of their function.
16. programmable i/o ports page 217 9 2 3 f o 7 0 0 2 , 5 1 . b e f 0 0 . 2 . v e r 0 0 2 0 - 2 0 2 0 b 9 0 j e r ) t 6 2 / c 6 1 m , b 6 2 / c 6 1 m , a 6 2 / c 6 1 m ( p u o r g a 6 2 / c 6 1 m 16.4 port control register figure 16.4.1 shows the port control register. when the p1 register is read after setting the pcr0 bit in the pcr register to 1 , the corresponding port latch can be read no matter how the pd1 register is set. 16.5 pin assignment control register (pacr) figure 16.5.1 shows the pacr. after reset set the pacr2 to pacr0 bit before you input and output it to each pin. when the pacr register isn t set up, the input and output function of some of the pins doesn t work. pacr2 to pacr0 bits: control the pins enabled for use. at reset, these bits are 000 . in 48-pin package, set these bits to 100 2 . in 42-pin package, set these bits to 001 2 . u1map: controls the assignment of uart1 pins. if the u1map bit is set to 0 (p6 7 to p6 4 ) the uart1 functions are mapped to p6 4 /cts 1 /rts 1 , p6 5 /clk 1 , p6 6 /rxd 1 , and p6 7 /txd 1 . if the u1map bit is set to 1 (p7 3 to p7 0 ) the uart1 functions are mapped to p7 0 /cts 1 /rts 1 , p7 1 /clk 1 , p7 2 /rxd 1 , and p7 3 /txd 1 . pacr is write protected by prc2 bit in the prcr register. prc2 bit must be set immediately before the write to pacr. 16.6 digital debounce function two digital debounce function circuits are provided. level is determined when level is held, after applying either a falling edge or rising edge to the pin, longer than the programmed filter width time. this enables noise reduction. ________ _______ _____ this function is assigned to int5/inpc17 and nmi/sd. digital filter width is set in the nddr register and the p17ddr register respectively. additionally, a digital debounce function is disabled to the port p1 7 input and port p8 5 input. figure 16.6.1 shows the nddr register and the p17ddr register. filter width : (n+1)
16. programmable i/o ports page 218 9 2 3 f o 7 0 0 2 , 5 1 . b e f 0 0 . 2 . v e r 0 0 2 0 - 2 0 2 0 b 9 0 j e r ) t 6 2 / c 6 1 m , b 6 2 / c 6 1 m , a 6 2 / c 6 1 m ( p u o r g a 6 2 / c 6 1 m figure 16.1. i/o ports (1) p10 0 to p10 3 data bus (1) analog input pull-up selection direction register port latch p1 5 , p1 6 data bus p1 7 (inside dotted-line not included) (inside dotted-line included) direction register port latch pull-up selection (1) port p1 control register input to respective peripheral functions digital debounce inpc1 7 /int5 "1" output data bus direction register port latch pull-up selection (1) input to respective peripheral functions note: 1. symbolizes a parasitic diode. make sure the input voltage on each port will not exceed vcc. p6 0 , p6 1 , p6 4 , p6 5 , p7 4 to p7 6 , p8 0 , p8 1
16. programmable i/o ports page 219 9 2 3 f o 7 0 0 2 , 5 1 . b e f 0 0 . 2 . v e r 0 0 2 0 - 2 0 2 0 b 9 0 j e r ) t 6 2 / c 6 1 m , b 6 2 / c 6 1 m , a 6 2 / c 6 1 m ( p u o r g a 6 2 / c 6 1 m figure 16.2. i/o ports (2) data bus pull-up selection direction register port latch data bus pull-up selection direction register port latch input to respective peripheral functions input to respective peripheral functions "1" output data bus direction register port latch pull-up selection (1) input to respective peripheral functions switching between cmos and nch (1) (1) note: 1. symbolizes a parasitic diode. make sure the input voltage on each port will not exceed vcc. p7 0 to p7 3 p8 2 to p8 4 p6 2 , p6 6 , p7 7
16. programmable i/o ports page 220 9 2 3 f o 7 0 0 2 , 5 1 . b e f 0 0 . 2 . v e r 0 0 2 0 - 2 0 2 0 b 9 0 j e r ) t 6 2 / c 6 1 m , b 6 2 / c 6 1 m , a 6 2 / c 6 1 m ( p u o r g a 6 2 / c 6 1 m figure 16.3. i/o ports (3) p8 5 p6 3 , p6 7 output 1 data bus pull-up selection direction register port latch switching between cmos and nch note: 1. symbolizes a parasitic diode. make sure the input voltage on each port will not exceed vcc. data bus pull-up selection direction register port latch nmi interrupt input nmi enable digital debounce nmi enable sd (1) (1 ) data bus direction register pull-up selection port latch analog input input to respective peripheral functions (1) p9 1 , p9 2 , p10 4 to p10 7
16. programmable i/o ports page 221 9 2 3 f o 7 0 0 2 , 5 1 . b e f 0 0 . 2 . v e r 0 0 2 0 - 2 0 2 0 b 9 0 j e r ) t 6 2 / c 6 1 m , b 6 2 / c 6 1 m , a 6 2 / c 6 1 m ( p u o r g a 6 2 / c 6 1 m figure 16.4. i/o ports (4) 1 output direction register data bus port latch analog input pull-up selection (1) p8 7 p8 6 fc rf rd data bus direction register pull-up selection port latch direction register pull-up selection port latch data bus (1) (1 ) input to respective peripheral functions p9 0 (inside dotted-line included) p9 3 (inside dotted-line not included) note: 1. symbolizes a parasitic diode. make sure the input voltage on each port will not exceed vcc.
16. programmable i/o ports page 222 9 2 3 f o 7 0 0 2 , 5 1 . b e f 0 0 . 2 . v e r 0 0 2 0 - 2 0 2 0 b 9 0 j e r ) t 6 2 / c 6 1 m , b 6 2 / c 6 1 m , a 6 2 / c 6 1 m ( p u o r g a 6 2 / c 6 1 m figure 16.5. i/o pins cnv ss cnv ss signal input reset reset signal input (1) (1) note: 1. symbolizes a parasitic diode. make sure the input voltage on each port will not exceed vcc.
16. programmable i/o ports page 223 9 2 3 f o 7 0 0 2 , 5 1 . b e f 0 0 . 2 . v e r 0 0 2 0 - 2 0 2 0 b 9 0 j e r ) t 6 2 / c 6 1 m , b 6 2 / c 6 1 m , a 6 2 / c 6 1 m ( p u o r g a 6 2 / c 6 1 m figure 16.1.1. pd1, pd6, pd7, pd8, pd9, and pd10 registers port pi direction register (i=6 to 8, and 10) (1) symbol address after reset pd6 to pd8 03ee 16 , 03ef 16 , 03f2 16 00 16 pd10 03f6 16 00 16 bit name function bit symbol rw b7 b6 b5 b4 b3 b2 b1 b0 pdi_0 port pi 0 direction bit pdi_1 port pi 1 direction bit pdi_2 port pi 2 direction bit pdi_3 port pi 3 direction bit pdi_4 port pi 4 direction bit pdi_5 port pi 5 direction bit pdi_6 port pi 6 direction bit pdi_7 port pi 7 direction bit 0 : input mode (functions as an input port) 1 : output mode (functions as an output port) (i = 6 to 8, and 10) rw rw rw rw rw rw rw rw port p1 direction register (1) symbol address after reset pd1 03e3 16 00 16 bit name function bit symbol b7 b6 b5 b4 b3 b2 b1 b0 0 : input mode (functions as an input port) 1 : output mode (functions as an output port) rw pd1_5 port p1 5 direction bit rw pd1_6 port p1 6 direction bit rw pd1_7 port p1 7 direction bit rw nothing is assigned. in an attempt to write to this bit, write 0 . the value, if read, turns out to be indeterminate. (b4-b0) port p9 direction register (1,2) symbol address after reset pd9 03f3 16 xxxx0000 2 bit name function bit symbol b7 b6 b5 b4 b3 b2 b1 b0 pd9_0 port p9 0 direction bit pd9_1 port p9 1 direction bit pd9_2 port p9 2 direction bit pd9_3 port p9 3 direction bit 0 : input mode (functions as an input port) 1 : output mode (functions as an output port) rw rw rw rw rw nothing is assigned. in an attempt to write to this bit, write 0 . the value, if read, turns out to be indeterminate. (b7-b4) note: 1. ports must be enabled using the pacr register. in 48-pin package, set pacr2, pacr1, pacr0 to "100 2 " in 42-pin package, set pacr2, pacr1, pacr0 to "001 2 " note: 1. ports must be enabled using the pacr register. in 48-pin package, set pacr2, pacr1, pacr0 to "100 2 " in 42-pin package, set pacr2, pacr1, pacr0 to "001 2 " note: 1. make sure the pd9 register is written to by the next instruction after setting the prc2 bit in the prcr register to "1" (write enabled). 2. ports must be enabled using the pacr register.
16. programmable i/o ports page 224 9 2 3 f o 7 0 0 2 , 5 1 . b e f 0 0 . 2 . v e r 0 0 2 0 - 2 0 2 0 b 9 0 j e r ) t 6 2 / c 6 1 m , b 6 2 / c 6 1 m , a 6 2 / c 6 1 m ( p u o r g a 6 2 / c 6 1 m symbol address after reset p6 to p8 03ec 16 , 03ed 16 , 03f0 16 indeterminate p10 03f4 16 indeterminate port pi register (i=6 to 8 and 10) (1) bit name function bit symbol rw b7 b6 b5 b4 b3 b2 b1 b0 pi_0 port pi 0 bit pi_1 port pi 1 bit pi_2 port pi 2 bit pi_3 port pi 3 bit pi_4 port pi 4 bit pi_5 port pi 5 bit pi_6 port pi 6 bit pi_7 port pi 7 bit the pin level on any i/o port which is set for input mode can be read by reading the corresponding bit in this register. the pin level on any i/o port which is set for output mode can be controlled by writing to the corresponding bit in this register 0 : l level 1 : h level (1) (i = 6 to 8 and 10) rw rw rw rw rw rw rw rw port p1 register (1) symbol address after reset p1 03e1 16 indeterminate bit name function bit symbol b7 b6 b5 b4 b3 b2 b1 b0 p1_5 port p1 5 bit p1_6 port p1 6 bit p1_7 port p1 7 bit the pin level on any i/o port which is set for input mode can be read by reading the corresponding bit in this register. the pin level on any i/o port which is set for output mode can be controlled by writing to the corresponding bit in this register 0 : l level 1 : h level rw rw rw rw nothing is assigned. in an attempt to write to this bit, write 0 . the value, if read, turns out to be indeterminate. (b4-b0) port p9 register (1) symbol address after reset p9 03f1 16 indeterminate bit name function bit symbol b7 b6 b5 b4 b3 b2 b1 b0 p9_0 port p9 0 bit p9_1 port p9 1 bit p9_2 port p9 2 bit p9_3 port p9 3 bit the pin level on any i/o port which is set for input mode can be read by reading the corresponding bit in this register. the pin level on any i/o port which is set for output mode can be controlled by writing to the corresponding bit in this register 0 : l level 1 : h level rw rw rw rw rw nothing is assigned. in an attempt to write to this bit, write 0 . the value, if read, turns out to be indeterminate. (b7-b4) note: 1. ports must be enabled using the pacr register. in 48-pin package, set pacr2, pacr1, pacr0 to "100 2 " in 42-pin package, set pacr2, pacr1, pacr0 to "001 2 " note: 1. ports must be enabled using the pacr register. in 48-pin package, set pacr2, pacr1, pacr0 to "100 2 " in 42-pin package, set pacr2, pacr1, pacr0 to "001 2 " note: 1. ports must be enabled using the pacr register. in 48-pin package, set pacr2, pacr1, pacr0 to "100 2 " in 42-pin package, set pacr2, pacr1, pacr0 to "001 2 " figure 16.2.1. p1, p6, p7, p8, p9, and p10 registers
16. programmable i/o ports page 225 9 2 3 f o 7 0 0 2 , 5 1 . b e f 0 0 . 2 . v e r 0 0 2 0 - 2 0 2 0 b 9 0 j e r ) t 6 2 / c 6 1 m , b 6 2 / c 6 1 m , a 6 2 / c 6 1 m ( p u o r g a 6 2 / c 6 1 m figure 16.3.1. pur0 to pur2 registers pull-up control register 0 symbol address after reset pur0 03fc 16 00 16 bit name function bit symbol rw b7 b6 b5 b4 b3 b2 b1 b0 pu03 p1 5 to p1 7 pull-up 0 : not pulled high 1 : pulled high (1) rw note: 1. the pin for which this bit is 1 (pulled high) and the direction bit is 0 (input mode) is pulled high. pull-up control register 2 symbol address after reset pur2 03fe 16 00 16 bit name function bit symbol b7 b6 b5 b4 b3 b2 b1 b0 pu20 p8 0 to p8 3 pull-up pu21 p8 4 to p8 7 pull-up pu22 p9 0 to p9 3 pull-up pu24 p10 0 to p10 3 pull-up pu25 p10 4 to p10 7 pull-up nothing is assigned. in an attempt to write to these bits, write 0 . the value, if read, turns out to be 0 . 0 : not pulled high 1 : pulled high (1) rw rw rw rw rw rw (b7-b6) note: 1. the pin for which this bit is 1 (pulled high) and the direction bit is 0 (input mode) is pulled high. nothing is assigned. in an attempt to write to these bits, write 0 . the value, if read, turns out to be 0 . (b2-b0) nothing is assigned. in an attempt to write to these bits, write 0 . the value, if read, turns out to be 0 . (b7-b4) pull-up control register 1 symbol address after reset pur1 03fd 16 00000000 2 bit name function bit symbol b7 b6 b5 b4 b3 b2 b1 b0 pu14 p6 0 to p6 3 pull-up pu15 p6 4 to p6 7 pull-up pu16 p7 0 to p7 3 pull-up pu17 p7 4 to p7 7 pull-up 0 : not pulled high 1 : pulled high (1) note: 1. the pin for which this bit is 1 (pulled high) and the direction bit is 0 (input mode) is pulled high. rw rw rw rw rw nothing is assigned. in an attempt to write to these bits, write 0 . the value, if read, turns out to be 0 . (b3-b0) 0 : not pulled high 1 : pulled high (1) nothing is assigned. in an attempt to write to these bits, write 0 . the value, if read, turns out to be 0 . (b3)
16. programmable i/o ports page 226 9 2 3 f o 7 0 0 2 , 5 1 . b e f 0 0 . 2 . v e r 0 0 2 0 - 2 0 2 0 b 9 0 j e r ) t 6 2 / c 6 1 m , b 6 2 / c 6 1 m , a 6 2 / c 6 1 m ( p u o r g a 6 2 / c 6 1 m figure 16.4.1. pcr register port control register symbpl address after reset pcr 03ff 16 00 16 bit name function bit symbol rw b7 b6 b5 b4 b3 b2 b1 b0 pcr0 port p1 control bit nothing is assigned. in an attempt to write to these bits, write 0 . the value, if read, turns out to be 0 . rw (b7-b1) operation performed when the p1 register is read 0: when the port is set for input, the input levels of p10 to p17 pins are read. when set for output, the port latch is read. 1: the port latch is read regardless of whether the port is set for input or output. figure 16.5.1. pacr register pin assignment control register (1) symbpl address after reset pacr 025d 16 00 16 bit name function bit symbol rw b7 b6 b5 b4 b3 b2 b1 b0 pin enabling bit nothing is assigned. when write, set to 0 . when read, its content is 0 . rw (b6-b3) 001 : 42 pin 100 : 48 pin all other values are reserved. do not use. pacr0 pacr1 pacr2 rw rw reserved bits u1map uart1 pin remapping bit uart1 pins assigned to 0 : p6 7 to p6 4 1 : p7 3 to p7 0 rw notes: 1. set the pacr register by the next instruction after setting the prc2 bit in the prcr register to "1"(write enable).
16. programmable i/o ports page 227 9 2 3 f o 7 0 0 2 , 5 1 . b e f 0 0 . 2 . v e r 0 0 2 0 - 2 0 2 0 b 9 0 j e r ) t 6 2 / c 6 1 m , b 6 2 / c 6 1 m , a 6 2 / c 6 1 m ( p u o r g a 6 2 / c 6 1 m figure 16.6.1. nddr and p17ddr registers nmi digital debounce register (1,2) symbol address after reset nddr 033e 16 ff 16 rw b7 b0 functio n rw setting range 00 16 to ff 16 if the set value =n, - n = 0 to fe 16 ; a signal with pulse width, greater than (n+1)/f8, is input into nmi / sd - n = ff 16 ; the digital debounce filter is disabled and all signals are input p1 7 digital debounce register (1) symbol address after reset p17ddr 033f 16 ff 16 rw b7 b0 functio n rw setting range 00 16 to ff 16 if the set value =n, - n = 0 to fe 16 ; a signal with pulse width, greater than (n+1)/f8, is input into inpc17/ int5 - n = ff 16 ; the digital debounce filter is disabled and all signals are input note: 1. when using the int5 interrupt to exit from stop mode, set the p17ddr registert to "ff 16 " before entering stop mode. notes: 1. set the pacr register by the next instruction after setting the prc2 bit in the prcr register to "1"(write enable). 2. when using the nmi interrupt to exit from stop mode, set the nddr registert to "ff 16 " before entering stop mode.
16. programmable i/o ports page 228 9 2 3 f o 7 0 0 2 , 5 1 . b e f 0 0 . 2 . v e r 0 0 2 0 - 2 0 2 0 b 9 0 j e r ) t 6 2 / c 6 1 m , b 6 2 / c 6 1 m , a 6 2 / c 6 1 m ( p u o r g a 6 2 / c 6 1 m figure 16.6.2. functioning of digital debounce filter f 8 p8 5 / p1 7 data bus 1. (condition after reset). reload = ff, port in = signal out continuosly. 2. reload = 03. at edge of port in != signal out, counter gets reload value and stats counting down. 3. port in = signal out, counting stops. 4. at edge of port in != signal out, counter gets reload value and starts counting. 5. counter underflows, stops, and port in is driven to signal out. 6. at edge of port in != signal out, counter gets reload value and starts counting. 7. counter underflows, stops, and port in is driven to signal out. 8. at edge of port in != signal out, counter gets reload value and starts counting. 9. ff is written to reload value. counter is stopped and loaded with ff. port in = signal out continuously. clock port in reload value (write) digital debounce filter signal out count value (read) to nmi and sd / int5 and inpc17 data bus f 8 reload value port in signal out count value reload value (continued) port in (continued) signal out (continued) count value (continued) ff 03 ff 03 02 01 03 02 01 00 ff 03 ff 03 02 01 00 ff ff 03 02 ff 1 2 3 4 5 6 7 8 9
16. programmable i/o ports page 229 9 2 3 f o 7 0 0 2 , 5 1 . b e f 0 0 . 2 . v e r 0 0 2 0 - 2 0 2 0 b 9 0 j e r ) t 6 2 / c 6 1 m , b 6 2 / c 6 1 m , a 6 2 / c 6 1 m ( p u o r g a 6 2 / c 6 1 m pin name connection ports p1, p6 to p10 x out (3) av ss , v ref av cc after setting for input mode, connect every pin to v ss via a resistor(pull-down); or after setting for output mode, leave these pins open. (1, 2, 4) open connect to v cc connect to v ss connect via resistor to v cc (pull-up) (5) x in notes: 1. when setting the port for output mode and leave it open, be aware that the port remains in input mode until it is switched to output mode in a program after reset. for this reason, the voltage level on the pin becomes indeterminate, causing the power supply current to increase while the port remains in input mode. futhermore, by considering a possibility that the contents of the direction registers could be changed by noise or noise- induced runaway, it is recommended that the contents of the direction registers be periodically reset in software, for the increased reliability of the program. 2. make sure the unused pins are processed with the shortest possible wiring from the microcomputer pins (within 2 cm). 3. with external clock or vcc input to xin pin. 4. when using the 48-pin package, set pacr2, pacr1, pacr0 to "100 2 ". when using the 42-pin package, set pacr2, pacr1, pacr0 to "001 2 ". 5. when the main clock oscillation circuit is not used, set the cm05 bit in the cm0 register to 0 (main clock stops) to reduce power consumption. table 16.1. unassigned pin handling in single-chip mode figure 16.7. unassigned pins handling (input mode) (input mode) (output mode) x out av cc av ss v ref microcomputer v cc v ss in single-chip mode open open (1) port p1, p6 to p10 x in note: 1. when using the 48-pin package, set pacr2, pacr1, pacr0 to "100 2 ". when using the 42pin-package, set pacr2, pacr1, pacr0 to "001 2 ".
17. flash memory version page 230 9 2 3 f o 7 0 0 2 , 5 1 . b e f 0 0 . 2 . v e r 0 0 2 0 - 2 0 2 0 b 9 0 j e r ) t 6 2 / c 6 1 m , b 6 2 / c 6 1 m , a 6 2 / c 6 1 m ( p u o r g a 6 2 / c 6 1 m table 17.1. flash memory version specifications item flash memory operating mode erase block program method erase method program, erase control method protect method number of commands program/erase endurance (1) rom code protection specification 3 modes (cpu rewrite, standard serial i/o, parallel i/o) see figure 17.2.1 to 17.2.3 flash memory block diagram in units of word block erase program and erase controlled by software command all user blocks are write protected by bit fmr16. in addition, the block 0 and block 1 are write protected by bit fmr02 5 commands 100 times, 1,000 times (see tables 1.7, 1.9, and 1.10 ) 100 times, 10,000 times (see tables 1.7, 1.9, and 1.10 ) parallel i/o and standard serial i/o modes are supported. data retention 20 years (topr = 55 17. flash memory version 17.1 flash memory performance the flash memory version is functionally the same as the mask rom version except that it internally con- tains flash memory. in the flash memory version, the flash memory can perform in three rewrite mode : cpu rewrite mode, standard serial i/o mode and parallel i/o mode. table 17.1 shows the flash memory version specifications. (refer to table 1.1 or table 1.2 for the items not listed in table 17.1.)
17. flash memory version page 231 9 2 3 f o 7 0 0 2 , 5 1 . b e f 0 0 . 2 . v e r 0 0 2 0 - 2 0 2 0 b 9 0 j e r ) t 6 2 / c 6 1 m , b 6 2 / c 6 1 m , a 6 2 / c 6 1 m ( p u o r g a 6 2 / c 6 1 m table 17.2. flash memory rewrite modes overview flash memory cpu rewrite mode standard serial i/o mode parallel i/o mode rewrite mode function area which user rom area user rom area user rom area can be rewritten operation single chip mode boot mode parallel i/o mode mode rom none serial programmer parallel programmer programmer the user rom area is rewrit- ten when the cpu executes software command ew0 mode: rewrite in area other than flash memory ew1 mode: rewrite in flash memory the user rom area is rewrit- ten using a dedicated serial programmer. standard serial i/o mode 1: clock synchronous serial i/o standard serial i/o mode 2: uart the user rom area is rewrit- ten using a dedicated paral- lel programmer 17.1.1 boot mode the mcu enters boot mode when a hardware reset is performed while a high-level ("h") signal is applied to pins cnv ss and p8 6 or while an "h" signal is applied to pins cnv ss and p1 6 and a low-level ("l") signal is applied to the p8 5 . a program in the boot rom area is executed. the boot rom area is reserved. the boot rom area stores the rewrite control program for a standard serial i/o mode before shipping. do not rewrite the boot rom area.
17. flash memory version page 232 9 2 3 f o 7 0 0 2 , 5 1 . b e f 0 0 . 2 . v e r 0 0 2 0 - 2 0 2 0 b 9 0 j e r ) t 6 2 / c 6 1 m , b 6 2 / c 6 1 m , a 6 2 / c 6 1 m ( p u o r g a 6 2 / c 6 1 m 17.2 memory map the flash memory contains the user rom area and the boot rom area (reserved area). figures 17.2.1 to 17.2.3 show the flash memory block diagram. the user rom area has space to store the microcomputer operation program in single-chip mode and a separate 2-kbyte space as the block a and b. the user rom area is divided into several blocks. the user rom area can be rewritten in cpu rewrite, standard serial input/output, and parallel input/output modes. however, if block 0 and 1 are rewritten in cpu rewrite mode, setting the fmr02 bit in the fmr0 register to 1 (block 0, 1 rewrite enabled) and the fmr16 bit in the fmr1 register to 1 (blocks 0 to 3 rewrite enabled) enable rewriting. also, if blocks 2 to 3 are rewritten in cpu rewrite mode, setting the fmr16 bit in the fmr1 register to 1 (blocks 0 to 3 rewrite enabled) enables writing. setting the pm10 bit in the pm1 register to 1 (data area access enabled) for block a and b enables to use. 0 0 f f f f 1 6 b l o c k b : 2 k b y t e s (2) 0 0 f 0 0 0 1 6 4 k b y t e s (4) 0 f f 0 0 0 1 6 0 f f f f f 1 6 b o o t r o m a r e a 0 f e 0 0 0 1 6 0 f c 0 0 0 1 6 0 f d f f f 1 6 0 f 8 0 0 0 1 6 b l o c k 2 : 1 6 k b y t e s 0 f b f f f 1 6 0 f 7 f f f 1 6 0 f 0 0 0 0 1 6 0 f f f f f 1 6 u s e r r o m a r e a b l o c k a : 2 k b y t e s (2) b l o c k 2 : 1 6 k b y t e s (5) b l o c k 3 : 3 2 k b y t e s (5) b l o c k 1 : 8 k b y t e s (3) b l o c k 0 : 8 k b y t e s (3) 0 0 f 7 f f 1 6 0 0 f 8 0 0 1 6 notes: 1. to specify a block, use the maximum even address in the block. 2. blocks a and b are enabled to use when the pm10 bit in the pm1 register is set to "1". 3. blocks 0 and 1 are enabled for programs and erases when the fmr02 bit in the fmr0 register is set to "1" and the fmr16 bit in the fmr1 register is set to "1". (cpu rewrite mode only) 4. the boot rom area is reserved. do not access. 5. blocks 2 and 3 are enabled for programs and erases when the fmr16 bit in the fmr1 register is set to "1". (cpu rewrite mode only) figure 17.2.1. flash memory block diagram (rom capacity 64k byte)
17. flash memory version page 233 9 2 3 f o 7 0 0 2 , 5 1 . b e f 0 0 . 2 . v e r 0 0 2 0 - 2 0 2 0 b 9 0 j e r ) t 6 2 / c 6 1 m , b 6 2 / c 6 1 m , a 6 2 / c 6 1 m ( p u o r g a 6 2 / c 6 1 m b l o c k b : 2 k b y t e s (2) 4 k b y t e s (4) 0 f f 0 0 0 1 6 0 f f f f f 1 6 b o o t r o m a r e a 0 f e 0 0 0 1 6 0 f c 0 0 0 1 6 0 f d f f f 1 6 0 f 8 0 0 0 1 6 0 f b f f f 1 6 0 f 7 f f f 1 6 0 f 4 0 0 0 1 6 0 f f f f f 1 6 u s e r r o m a r e a b l o c k 2 : 1 6 k b y t e s (5) b l o c k a : 2 k b y t e s (2) b l o c k 1 : 8 k b y t e s (3) b l o c k 0 : 8 k b y t e s (3) b l o c k 3 : 1 6 k b y t e s (5) notes: 1. to specify a block, use the maximum even address in the block. 2. blocks a and b are enabled to use when the pm10 bit in the pm1 register is set to "1". 3. blocks 0 and 1 are enabled for programs and erases when the fmr02 bit in the fmr0 register is set to "1" and the fmr16 bit in the fmr1 register is set to "1". (cpu rewrite mode only) 4. the boot rom area is reserved. do not access. 5. blocks 2 and 3 are enabled for programs and erases when the fmr16 bit in the fmr1 register is set to "1". (cpu rewrite mode only) 00f000 16 00f7ff 16 00f800 16 00ffff 16 figure 17.2.2. flash memory block diagram (rom capacity 48k byte)
17. flash memory version page 234 9 2 3 f o 7 0 0 2 , 5 1 . b e f 0 0 . 2 . v e r 0 0 2 0 - 2 0 2 0 b 9 0 j e r ) t 6 2 / c 6 1 m , b 6 2 / c 6 1 m , a 6 2 / c 6 1 m ( p u o r g a 6 2 / c 6 1 m 0 0 f f f f 1 6 b l o c k b : 2 k b y t e s (2) 0 0 f 0 0 0 1 6 4 k b y t e s (4) 0 f f 0 0 0 1 6 0 f f f f f 1 6 b o o t r o m a r e a 0 f e 0 0 0 1 6 0 f c 0 0 0 1 6 0 f d f f f 1 6 0 f a 0 0 0 1 6 0 f b f f f 1 6 0 f f f f f 1 6 u s e r r o m a r e a b l o c k a : 2 k b y t e s (2) b l o c k 2 : 8 k b y t e s (5) b l o c k 1 : 8 k b y t e s (3) b l o c k 0 : 8 k b y t e s (3) 0 0 f 7 f f 1 6 0 0 f 8 0 0 1 6 notes: 1. to specify a block, use the maximum even address in the block. 2. blocks a and b are enabled to use when the pm10 bit in the pm1 register is set to "1". 3. blocks 0 and 1 are enabled for programs and erases when the fmr02 bit in the fmr0 register is set to "1" and the fmr16 bit in the fmr1 register is set to "1". (cpu rewrite mode only) 4. the boot rom area is reserved. do not access. 5. blocks 2 are enabled for programs and erases when the fmr16 bit in the fmr1 register is set to "1". (cpu rewrite mode only) figure 17.2.3. flash memory block diagram (rom capacity 24k byte)
17. flash memory version page 235 9 2 3 f o 7 0 0 2 , 5 1 . b e f 0 0 . 2 . v e r 0 0 2 0 - 2 0 2 0 b 9 0 j e r ) t 6 2 / c 6 1 m , b 6 2 / c 6 1 m , a 6 2 / c 6 1 m ( p u o r g a 6 2 / c 6 1 m 17.3 functions to prevent flash memory from rewriting the flash memory has a built-in rom code protect function for parallel i/o mode and a built-in id code check function for standard input/output mode to prevent the flash memory from reading or rewriting. 17.3.1 rom code protect function the rom code protect function disables reading or changing the contents of the on-chip flash memory in parallel i/o mode. figure 17.3.1.1 shows the romcp address. the romcp address is located in a user rom area. to enable rom code protect, set the romcp1 bit to 00 2 , 01 2 , or 10 2 and set the bit 5 to bit 0 to 111111 2 . to cancel rom code protect, erase the block including the the romcp address in cpu rewrite mode or standard serial i/o mode. 17.3.2 id code check function use the id code check function in standard serial input/output mode. unless the flash memory is blank, the id codes sent from the programmer and the seven bytes id codes written in the flash memory are compared to see if they match. if the id codes do not match, the commands sent from the programmer are not acknowledged. the id code consists of 8-bit data, starting with the first byte, into addresses, 0fffdf 16 , 0fffe3 16 , 0fffeb 16 , 0fffef 16 , 0ffff3 16 , 0ffff7 16 , and 0ffffb 16 . the flash memory has a program with the id code set in these addresses.
17. flash memory version page 236 9 2 3 f o 7 0 0 2 , 5 1 . b e f 0 0 . 2 . v e r 0 0 2 0 - 2 0 2 0 b 9 0 j e r ) t 6 2 / c 6 1 m , b 6 2 / c 6 1 m , a 6 2 / c 6 1 m ( p u o r g a 6 2 / c 6 1 m figure 17.3.1.1. romcp address figure 17.3.2.1. address for id code stored symbol address factory setting romcp 0fffff 16 ff 16 (4) rom code protect control address (5) bit name function bit symbol b7 b6 b5 b4 b3 b2 b1 b0 00: 01: 10: 11: disables protect rom code protect level 1 set bit (1, 2, 3, 4) romcp1 b7 b6 1 1 reserved bit set to 1 enables protect } notes: 1. when the rom code protect is active by the romcp1 bit setting, the flash memory is protected against reading or rewriting in parallel i/o mode. 2. set the bit 5 to bit 0 to 111111 2 when the romcp1 bit is set to a value other than 11 2 . if the bit 5 to bit 0 are set to values other than 111111 2 , the rom code protection may not become active by setting the romcp1 bit to a value other than 11 2 . 3. to make the rom code protection inactive, erase a block including the romcp address in standard serial i/o mode or cpu rewrite mode. 4. the romcp address is set to ff 16 when a block, including the romcp address, is erased. 5. when a value of the romcp address is 00 16 or ff 16 , the rom code protect function is disabled. 1 1 rw rw rw rw (b5-b0) 1 1 reset vector watchdog timer vector single step vector address match vector brk instruction vector overflow vector undefined instruction vector id7 id6 id5 id4 id3 id2 id1 dbc vector nmi vector 0fffff 16 to 0ffffc 16 0ffffb 16 to 0ffff8 16 0ffff7 16 to 0ffff4 16 0ffff3 16 to 0ffff0 16 0fffef 16 to 0fffec 16 0fffeb 16 to 0fffe8 16 0fffe7 16 to 0fffe4 16 0fffe3 16 to 0fffe0 16 0fffdf 16 to 0fffdc 16 4 bytes address romcp
17. flash memory version page 237 9 2 3 f o 7 0 0 2 , 5 1 . b e f 0 0 . 2 . v e r 0 0 2 0 - 2 0 2 0 b 9 0 j e r ) t 6 2 / c 6 1 m , b 6 2 / c 6 1 m , a 6 2 / c 6 1 m ( p u o r g a 6 2 / c 6 1 m item ew0 mode ew1 mode operation mode single chip mode single chip mode area where user rom area user rom area rewrite control program can be placed area where the rewrite control program must be the rewrite control program can be rewrite control transferred to any area other than executed in the user rom area program can be the flash memory (e.g., ram) before executed being executed area which can be user rom area user rom area rewritten however, this excludes blocks with the rewrite control program software command none ? program, block erase command restrictions cannot be executed in a block having the rewrite control program ? read status register command can not be used mode after programming read status register mode read array mode or erasing cpu state during auto- operation hold state (i/o ports retain the state write and auto-erase before the command is executed (1) flash memory status ? read the fmr00, fmr06 and read the fmr0 register's fmr00, detection (2) fmr07 bits in the fmr0 register by fmr06, and fmr07 bits in a program a program ? execute the read status register command and read the sr7, sr5 and sr4 bits condition for transferring set the fmr40 and fmr41 bits in the fmr40 bit in the fmr4 register to erase-suspend (3) the fmr4 register to "1" by program. is set to "1" and the interrupt request of 17.4 cpu rewrite mode in cpu rewrite mode, the user rom area can be rewritten when the cpu executes software commands. therefore, the user rom area can be rewritten directly while the microcomputer is mounted on-board without using a rom programmer, etc. verify the program and the block erase commands are executed only on blocks in the user rom area. for interrupts requested during an erasing operation in cpu rewrite mode, the m16c/26a group flash module offers an erase-suspend function which the erasing operation to be suspended, and access made available to the flash. erase-write 0 (ew0) mode and erase-write 1 (ew1) mode are provided as cpu rewrite mode. table 17.4.1 shows the differences between erase-write 0 (ew0) and erase-write 1 (ew1) modes. 1 wait is required for the cpu erase-write control. table 17.4.1. ew0 mode and ew1 mode notes: 1. do not generate a dma transfer. 2. block 1 and 0 are enabled to rewrite by setting the fmr02 bit in the fmr0 register to "1" and setting the fmr16 bit in the fmr1 register to "1". block 2 to 3 are enabled to rewrite by setting the fmr16 bit in the fmr1 register to "1". 3. the time, until entering erase suspend and reading flash is enabled, is maximum td (sr-es) after satisfying the conditions.
17. flash memory version page 238 9 2 3 f o 7 0 0 2 , 5 1 . b e f 0 0 . 2 . v e r 0 0 2 0 - 2 0 2 0 b 9 0 j e r ) t 6 2 / c 6 1 m , b 6 2 / c 6 1 m , a 6 2 / c 6 1 m ( p u o r g a 6 2 / c 6 1 m 17.4.1 ew0 mode the microcomputer enters cpu rewrite mode by setting the fmr01 bit in the fmr0 register to 1 (cpu rewrite mode enabled) and is ready to acknowledge the software commands. ew0 mode is selected by setting the fmr11 bit in the fmr1 register to 0 . when setting the fmr01 bit to 1 , set to 1 after first writing 0 . the software commands control pro- gramming and erasing. the fmr0 register or the status register indicates whether a programming or erasing operations is completed. when entering the erase-suspend during the auto-erasing, set the fmr40 bit to 1 (erase-suspend enabled) and the fmr41 bit to 1 (suspend request). and wait for td(sr-es). after verifying the fmr46 bit is set to 1 (auto-erase stop), access to the user rom area. when setting the fmr41 bit to 0 (erase restart), auto-erasing is restarted. 17.4.2 ew1 mode ew1 mode is selected by setting the fmr11 bit to 1 after the fmr01 bit is set to 1 . (set to 1 after first writing 0 ). the fmr0 register indicates whether or not a programming or an erasing operation is com- pleted. do not execute the software commands of read status register in ew1 mode. when an erase/program operation is initiated the cpu halts all program execution until the operation is completed or erase-suspend is requested. when enabling an erase suspend function, set the fmr40 bit to 1 (erase suspend enabled) and ex- ecute block erase commands. also, preliminarily set an interrupt to enter the erase-suspend to an inter- rupt enabled status. after td(sr-es) from an interrupt request and entering erase suspend, an interrupt can be acknowledged. when an interrupt request is generated, the fmr41 bit is automatically set to 1 (suspend request) and an auto-erasing is halted. if an auto-erasing is not completed (the fmr00 bit is 0 ) after an interrupt process completed, set the fmr41 bit to 0 (erase restart) and execute block erase commands again.
17. flash memory version page 239 9 2 3 f o 7 0 0 2 , 5 1 . b e f 0 0 . 2 . v e r 0 0 2 0 - 2 0 2 0 b 9 0 j e r ) t 6 2 / c 6 1 m , b 6 2 / c 6 1 m , a 6 2 / c 6 1 m ( p u o r g a 6 2 / c 6 1 m 17.5 register description figure 17.5.1 shows the flash memory control register 0 and flash memory control register 1. figure 17.5.2 shows the flash memory control register 4. 17.5.1 flash memory control register 0 (fmr0) ? fmr 00 bit this bit indicates the operation status of the flash memory. the bit is 0 during programming, erasing, or erase-suspend mode; otherwise, the bit is 1 . ? fmr01 bit the microcomputer enables to acknowledge commands by setting the fmr01 bit to 1 (cpu rewrite mode). to set this bit to 1 , it is necessary to set to 1 after first setting to 0 . set this bit to 0 by only writing 0 . ? fmr02 bit the combined setting of the fmr02 bit and the fmr16 bit enable to program and erase in the user rom area. see table 17.5.2.1 for setting details. to set this bit to 1 , it is necessary to set to 1 after first setting to 0 . set this bit to 0 by only writing 0 . this bit is enabled only when the fmr01 bit is 1 (cpu rewrite mode enable). ? fmstp bit this bit resets the flash memory control circuits and minimizes power consumption in the flash memory. access to the flash memory is disabled when the fmstp bit is set to 1 . set the fmstp bit by a program in a space other than the flash memory. set the fmstp bit to 1 if one of the following occurs: ? a flash memory access error occurs during erasing or programming in ew0 mode (fmr00 bit does not switch back to 1 (ready)). ? low-power consumption mode or on-chip oscillator low-power consumption mode is entered. figure 17.5.1.3 shows a flow chart illustrating how to start and stop the flash memory before and after entering low power mode. follow the procedure on this flow chart. to enter stop or wait mode when cpu rewrite mode is disabled, do not set the fmr0 register. the flash memory is automatically turned off when entering and turned back on when exiting. ? fmr06 bit this is a read-only bit indicating an auto-program operation status. this bit is set to 1 when a pro- gram error occurs; otherwise, it is set to 0 . for details, refer to 17.8.4 full status check . ? fmr07 bit this is a read-only bit indicating an auto-erase operation status. the bit is set to 1 when an erase error occurs; otherwise, it is set to 0 . for details, refer to 17.8.4 full status check . figure 17.5.1.1 shows a ew0 mode set/reset flowchart, figure 17.5.1.2 shows a ew1 mode set/reset flowchart.
17. flash memory version page 240 9 2 3 f o 7 0 0 2 , 5 1 . b e f 0 0 . 2 . v e r 0 0 2 0 - 2 0 2 0 b 9 0 j e r ) t 6 2 / c 6 1 m , b 6 2 / c 6 1 m , a 6 2 / c 6 1 m ( p u o r g a 6 2 / c 6 1 m 17.5.2 flash memory control register 1 (fmr1) ? fmr11 bit ew1 mode is entered by setting the fmr11 bit to 1 (ew1 mode). this bit is enabled only when the fmr01 bit is 1 . ? fmr16 bit the combined setting of the fmr02 bit and the fmr16 bit enables to program and erase in the user rom area. to set this bit to 1 , it is necessary to set to 1 after first setting to 0 . set this bit to 0 by only writing 0 . this bit is enabled only when the fmr01 bit is 1 . ? fmr17 bit if fmr17 bit is 1 (with wait state), regardless of the content of the pm17 bit, 1 wait is inserted at the access to block a and block b. regardless of the content of the fmr17 bit, access to other block and the internal ram is determined by pm17 bit setting. set this bit to 1 (with wait state) when rewriting more than 100 times (u7 and u9). table 17.5.2.1. protection using fmr16 and fmr02 fmr16 fmr02 block a, block b block 0, block 1 other user block 0 0 write enabled write disabled write disabled 0 1 write enabled write disabled write disabled 1 0 write enabled write disabled write enabled 1 1 write enabled write enabled write enabled 17.5.3 flash memory control register 4 (fmr4) ? fmr40 bit the erase-suspend function is enabled by setting the fmr40 bit is set to 1 (enabled). ? fmr41 bit when setting the fmr41 bit to 1 in a program during auto-erasing in ew0 mode the flash module enters erase suspend mode. in ew1 mode, the fmr41 bit is automatically set to 1 (suspend re- quest) when an interrupt request of an enabled interrupt is generated, the fmr41 bit is automatically set to 1 (suspend request) and when an auto-erasing operation is restarted, set the fmr41 bit to 0 (erase restart). ? fmr46 bit the fmr46 bit is set to 0 during auto-erasing execution and set to 1 during erase-suspend mode. do not access to flash memory while this bit is 0 .
17. flash memory version page 241 9 2 3 f o 7 0 0 2 , 5 1 . b e f 0 0 . 2 . v e r 0 0 2 0 - 2 0 2 0 b 9 0 j e r ) t 6 2 / c 6 1 m , b 6 2 / c 6 1 m , a 6 2 / c 6 1 m ( p u o r g a 6 2 / c 6 1 m figure 17.5.1. fmr0 and fmr1 register flash memory control register 0 symbol address after reset fmr0 01b7 16 00000001 2 b7 b6 b5 b4 b3 b2 b1 b0 fmr00 bit symbol bit name function rw 0: busy (during writing or erasing) 1: ready cpu rewrite mode select bit (1) 0: disables cpu rewrite mode (disables software command) 1: enables cpu rewrite mode (enables software commands) fmr01 block 0, 1 rewrite enable bit (2) set write protection for user rom area (see table 17.5.2.1 ) flash memory stop bit (3, 5) fmr02 fmstp 0 ry/by status flag reserved bit set to 0 0: terminated normally 1: terminated in error program status flag fmr06 0: terminated normally 1: terminated in error erase status flag fmr07 rw rw rw rw ro ro ro (b5-b4) 0: starts flash memory operation 1: stops flash memory operation (enters low-power consumption state and flash memory reset) 0 (4) (4) flash memory control register 1 symbol address after reset fmr1 01b5 16 000xxx0x 2 b7 b6 b5 b4 b3 b2 b1 b0 bit symbol bit name function ew1 mode select bit (1) 0: ew0 mode 1: ew1 mode fmr11 block a, b access wait bit (3) reserved bit when read, its content is indeterminate reserved bit set to 0 nothing is assigned. when write, set to 0 . when read, its contect is indeterminate. rw ro rw rw rw (b0) (b4) reserved bit (b3-b2) ro (b5) fmr16 rw block 0 to 3 rewrite enable bit (2) fmr17 set write protection for user rom area (see table 17.5.2.1 ) 0: disable 1: enable 0: pm17 enabled 1: with wait state (1 wait) when read, its content is indeterminate 0 notes: 1. when setting this bit to 1 , set to 1 immdediately after setting it first to 0 . do not generate an interrupt or a dma transfer between setting the bit to 0 and setting it to 1 . set this bit while the p8 5 /nmi/sd pin is h when selecting the nmi function. set by program in a space other than the flash memory in ew0 mode. set this bit to read alley mode and 0 2. set this bit to 1 immediately after setting it first to 0 while the fmr01 bit is set to 1 . do not generate an interrupt or a dma transfer between setting this bit to 0 and setting it to 1 . 3. set this bit in a pace other than the flash memory by program. when this bit is set to 1, access to flash memory will be denied. to set this bit to 0 after setting it to 1, wait for 10 0 by executing the clear status command. 5. this bit is enabled when the fmr01 bit is set to 1 (cpu rewrite mode). this bit can be set to 1 when the fmr01 bit is set to 0 . however, the flash memory does not enter low-power consumption status notes: 1. set this bit to 1 immediately after setting it first to 0 . do not generate an interrupt or a dma transfer between setting the bit to 0 and setting it to 1 . set this bit while the p8 5 /nmi/sd pin is h when the nmi function is selected. if the fmr01 bit is set to 0 , the fmr01 bit and fmr11 bit are both set to 0 2. set this bit to 1 immediately after setting it first to 0 . do not generate an interrupt or a dma transfer after setting to 0 . 3. when rewriting more than 100 times, set this bit to 1 (with wait state). when the fmr17 bit is 1 (with wait state), regardless of the content of the pm17 bit, 1 wait is inserted at the access to the block a and b. regardless of the content of the fmr17 bit, access to other block and the internal ram is determined be pm17 bit setting.
17. flash memory version page 242 9 2 3 f o 7 0 0 2 , 5 1 . b e f 0 0 . 2 . v e r 0 0 2 0 - 2 0 2 0 b 9 0 j e r ) t 6 2 / c 6 1 m , b 6 2 / c 6 1 m , a 6 2 / c 6 1 m ( p u o r g a 6 2 / c 6 1 m figure 17.5.2. fmr4 register flash memory control register 4 symbol address after reset fmr4 01b3 16 01000000 2 b7 b6 b5 b4 b3 b2 b1 b0 bit symbol bit name function erase suspend request bit (2) 0: erase restart 1: suspend request fmr41 0 reserved bit set to 0 erase suspend function enable bit (1) 0: disabled 1: enabled reserved bit set to 0 0 0 rw rw rw ro rw fmr40 (b5-b2) (b7) ro fmr46 00 erase status 0: during auto-erase operation 1: auto-erase stop (erase suspend mode) notes: 1. set the fmr40 bit to 1 immediately after setting it first to 0. do not generate any interrupt or dma transfer between setting the bit to 0 and setting it to 1. set by program in space other than the flash memory in ew mode 0. 2. the fmr41 bit is valid only when the fmr40 bit is set to 1. the fmr41 bit can be written only between executing an erase command and completing erase (this bit is set to 0 other than the above duration). the fmr41 bit can be set to 0 or 1 by program in ew mode 0. in ew mode 1, the fmr41 bit is automatically set to 1 when the fmr40 bit is 1 and a maskable interrupt is generated during erasing. the fmr41 bit cannot be set to 1 by program (it can be set to 0 by program).
17. flash memory version page 243 9 2 3 f o 7 0 0 2 , 5 1 . b e f 0 0 . 2 . v e r 0 0 2 0 - 2 0 2 0 b 9 0 j e r ) t 6 2 / c 6 1 m , b 6 2 / c 6 1 m , a 6 2 / c 6 1 m ( p u o r g a 6 2 / c 6 1 m execute the read array command (3) single-chip mode set cm0, cm1, and pm1 registers (1) execute software commands jump to the rewrite control program transfered to an internal ram area (in the following steps, use the rewrite control program internal ram area) transfer a rewrite control program to internal ram area write 0 to the fmr01 bit (cpu rewrite mode disabled) set the fmr01 bit to 1 after writing 0 (cpu rewrite mode enabled) (2) ew0 mode operation procedure rewrite control program jump to a specified address in the flash memory notes: 1. select 10 mhz or below for cpu clock using the cm06 bit in the cm0 register and cm17 to 16 bits in the cm1 register. also, set the pm17 bit in the pm1 register to 1 (with wait state). 2. set the fmr01 bit to 1 immediately after setting it to 0 . do not generate an interrupt or a dma transfer between setting the bit to 0 and setting it to 1 . set the fmr01 bit in a space other than the internal flash memory. also, set only when the p8 5 /nmi/sd pin is h at the time of the nmi function selected. 3. disables the cpu rewrite mode after executing the read array command. figure 17.5.1.1. setting and resetting of ew0 mode figure 17.5.1.2. setting and resetting of ew1 mode single-chip mode set cm0, cm1, and pm1 registers (1) set the fmr01 bit to 1 (cpu rewrite mode enabled) after writing 0 set the fmr11 bit to 1 (ew mode 1) after writing 0 (2, 3 ) program in rom ew mode 1 operation procedure execute software commands set the fmr01 bit to 0 (cpu rewrite mode disabled) notes: 1. select 10 mhz or below for cpu clock using the cm06 bit in the cm0 register and cm17 to 16 bits. in the cm1 register. also, set the pm17 bit in the pm1 register to 1 (with wait state). 2. set the fmr01 bits to 1 immediately after setting it to 0 . do not generate an interrupt or a dma transfer between setting the bit to 0 and setting the bit to 1 . set the fmr01 bit in a space other than the internal flash memory. set only when the p8 5 /nmi/sd pin is h at the time of the nmi function selected. 3. set the fmr11 bit to "1" immediately after setting it to "0" while the fmr01 bit is set to "1". do not generate an interrupt or a dma transfer between setting the fmr11 bit to "0" and setting it to "1".
17. flash memory version page 244 9 2 3 f o 7 0 0 2 , 5 1 . b e f 0 0 . 2 . v e r 0 0 2 0 - 2 0 2 0 b 9 0 j e r ) t 6 2 / c 6 1 m , b 6 2 / c 6 1 m , a 6 2 / c 6 1 m ( p u o r g a 6 2 / c 6 1 m figure 17.5.1.3. processing before and after low power dissipation mode start main clock oscillation transfer a low power internal consumption mode program to ram area switch the clock source of cpu clock. turn main clock off. (2) jump to the low power consumption mode program transferred to internal ram area. (in the following steps, use the low-power consumption mode program or internal ram area) wait until the flash memory circuit stabilizes (t ps) (3) set the fmstp bit to 0 (flash memory operation) set the fmstp bit to 1 (flash memory stopped. low power consumption state) (1) process of low power consumption mode or on-chip oscillator low power consumption mode switch the clock source of the cpu clock (2) low power consumption mode program set the fmr01 bit to 0 (cpu rewrite mode disabled) set the fmr01 bit to 1 after setting 0 (cpu rewrite mode enabled) jump to a desired address in the flash memory wait until oscillation stabilizes notes: 1. set the fmrstp bit to 1 after setting the fmr01 bit to 1 (cpu rewrite mode). 2. wait until the clock stabilizes to switch the clock source of the cpu clock to the main clock or the sub clock. 3. add a t ps wait time by a program. do not access the flash memory during this wait time.
17. flash memory version page 245 9 2 3 f o 7 0 0 2 , 5 1 . b e f 0 0 . 2 . v e r 0 0 2 0 - 2 0 2 0 b 9 0 j e r ) t 6 2 / c 6 1 m , b 6 2 / c 6 1 m , a 6 2 / c 6 1 m ( p u o r g a 6 2 / c 6 1 m 17.6 precautions in cpu rewrite mode described below are the precautions to be observed when rewriting the flash memory in cpu rewrite mode. 17.6.1 operation speed when cpu clock source is the main clock, before entering cpu rewrite mode (ew0 or ew1 mode), select 10 mhz or below for cpu clock using the cm06 bit in the cm0 register and the cm17 to cm16 bits in the cm1 register. also, when selecting f 3 (roc) of a on-chip oscillator as a cpu clock source, before entering cpu rewrite mode (ew0 or ew1 mode), the rocr3 to rocr2 bits in the rocr register set the cpu clock division rate to divide-by-4 or divide-by-8 . on both cases, set the pm17 bit in the pm1 register to 1 (with wait state). 17.6.2 prohibited instructions the following instructions cannot be used in ew0 mode because the cpu tries to read data in the flash memory: und instruction, into instruction, jmps instruction, jsrs instruction, and brk in- struction 17.6.3 interrupts ew0 mode ? to use interrupts having vectors in a relocatable vector table, the vectors must be relocated to the ram area. _______ ? the nmi and watchdog timer interrupts can be used since the fmr0 and fmr1 registers are forcibly reset when either interrupt is generated. however, the jump addresses for each interrupt service routines to the fixed vector table are set and interrupt programs are required. flash memory rewrite operation is halted when the nmi or watchdog timer interrupt is generated. set the fmr01 bit to 1 and execute the rewrite and erase program again after exiting the interrupt rou- tine. ? the address match interrupt can not be used since the cpu tries to read data in the flash memory. ew1 mode ? do not acknowledge any interrupts with vectors in the relocatable vector table or the address match interrupt during the auto-program or erase-suspend function. 17.6.4 how to access to set the fmr01, fmr02, fmr11 or fmr16 bit to 1 , write 1 after first setting the bit to 0 . do not generate an interrupt or a dma transfer between the instruction to set the bit to 0 and the instruction _______ to set it to 1 . when the nmi function is selected, set the bit while an h signal is applied to the p8 5 / _______ _____ nmi/sd pin. 17.6.5 writing in the user rom space 17.6.5.1 ew0 mode ? if the supply voltage drops while rewriting the block where the rewrite control program is stored, the flash memory can not be rewritten, because the rewrite control program is not correctly rewrit- ten. if this error occurs, rewrite the user rom area in standard serial i/o mode or parallel i/o mode. 17.6.5.2 ew1 mode ? do not rewrite the block where the rewrite control program is stored.
17. flash memory version page 246 9 2 3 f o 7 0 0 2 , 5 1 . b e f 0 0 . 2 . v e r 0 0 2 0 - 2 0 2 0 b 9 0 j e r ) t 6 2 / c 6 1 m , b 6 2 / c 6 1 m , a 6 2 / c 6 1 m ( p u o r g a 6 2 / c 6 1 m 17.6.6 dma transfer in ew1 mode, do not perform a dma transfer while the fmr00 bit in the fmr0 register is set to 0 . (the auto-programming or auto-erasing duration ). 17.6.7 writing command and data write the command code and data to even addresses in the user rom area. 17.6.8 wait mode when entering wait mode, set the fmr01 bit to 0 (cpu rewrite mode disabled) before executing the wait instruction. 17.6.9 stop mode when entering stop mode, set the fmr01 bit to 0 (cpu rewrite mode disabled) and disable the dma transfer before setting the cm10 bit to 1 (stop mode). 17.6.10 low power consumption mode and on-chip oscillator-low power consump- tion mode if the cm05 bit is set to 1 (main clock stopped), do not execute the following commands. ? program ? block erase
17. flash memory version page 247 9 2 3 f o 7 0 0 2 , 5 1 . b e f 0 0 . 2 . v e r 0 0 2 0 - 2 0 2 0 b 9 0 j e r ) t 6 2 / c 6 1 m , b 6 2 / c 6 1 m , a 6 2 / c 6 1 m ( p u o r g a 6 2 / c 6 1 m 17.7 software commands read or write 16-bit commands and data from or to even addresses in the user rom area. when writing a command code, 8 high-order bits (d 15 C d 8 ) are ignored. table 17.7.1. software commands 17.7.1 read array command (ff 16 ) this command reads the flash memory. by writing command code xxff 16 in the first bus cycle, read array mode is entered. content of a specified address can be read in 16-bit unit after the next bus cycle. the microcomputer remains in read array mode until an another command is written. therefore, contents of multiple addresses can be read consecutively. 17.7.2 read status register command (70 16 ) this command reads the status register. by writing command code xx70 16 in the first bus cycle, the status register can be read in the second bus cycle (refer to 17.8 status register ). read an even address in the user rom area. do not execute this command in ew1 mode. command program clear status register read array read status register first bus cycle second bus cycle block erase write write write write write mode read write write mode x wa ba address srd wd xxd0 16 data (d 15 to d 0 ) xxff 16 xx70 16 xx50 16 xx40 16 xx20 16 data (d 15 to d 0 ) x x x wa x address srd: status register data (d 7 to d 0 ) wa : write address (however,even address) wd : write data (16 bits) ba : highest-order block address (however,even address) x : any even address in the user rom area xx : 8 high-order bits of command code (ignored)
17. flash memory version page 248 9 2 3 f o 7 0 0 2 , 5 1 . b e f 0 0 . 2 . v e r 0 0 2 0 - 2 0 2 0 b 9 0 j e r ) t 6 2 / c 6 1 m , b 6 2 / c 6 1 m , a 6 2 / c 6 1 m ( p u o r g a 6 2 / c 6 1 m start program completed yes no write command code xx40 16 to the write address (1) write data to the write address (1) fmr00=1? full status check (2) note: 1: write the command code and data at even address.note 2: refer to " figure 17.8.4.1 . full status check and handling procedure for each error" figure 17.7.4.1. flow chart of program command 17.7.3 clear status register command (50 16 ) this command clears the status register to 0 . by writing xx50 16 in the first bus cycle, and the fmr06 to fmr07 bits in the fmr0 register and sr4 to sr5 bits in the status register are set to 0 . 17.7.4 program command (40 16 ) the program command writes 2-byte data to the flash memory. by writing xx40 16 in the first bus cycle and data to the write address specified in the second bus cycle, the auto-programming/erasing (data prorgramming and verify) start. set the address value specified in the first bus cycle to same and even address as the write address specified in the second bus cycle. the fmr00 bit in the fmr0 register indicates whether an auto-programming operation has been completed. the fmr00 bit is set to 0 during the auto-programming and 1 when the auto-programming operation is completed. after the auto-programming operation is completed, the fmr06 bit in the fmr0 register indicates whether or not the auto-programming operation has been completed as expected. (refer to 17.8.4 full status check ). also, each block disables writing (refer to table 17.5.2.1 ). do not write additions to the address which is already programmed. when commands other than a program command are ex- ecuted immediately after a program command, set the same address as the write address specified in the second bus cycle of the program command, to the specified address value in the first bus cycle of the following command. in ew1 mode, do not execute this command on the blocks where the rewrite control program is allocated. in ew0 mode, the microcomputer enters read status register mode as soon as the auto-programming operation starts and the status register can be read. the sr7 bit in the status register is set to 0 as soon as the auto-programming operation starts. this bit is set to 1 when the auto-programming operation is completed. the microcomputer remains in read status regis- ter mode until the read array command is written. after completion of the auto-programming operation, the status register indicates whether or not the auto-programming operation has been completed as expected.
17. flash memory version page 249 9 2 3 f o 7 0 0 2 , 5 1 . b e f 0 0 . 2 . v e r 0 0 2 0 - 2 0 2 0 b 9 0 j e r ) t 6 2 / c 6 1 m , b 6 2 / c 6 1 m , a 6 2 / c 6 1 m ( p u o r g a 6 2 / c 6 1 m write xxd0 16 to the highest-order block address (1) start block erase completed yes no write command code xx20 16 (1) fmr00=1? full status check (2,3) notes: 1. write the command code and data at even address. 2. refer to " figure 17.8.4.1. full status check and handling porcedure for each error ". 3. execute the clear status register command and block erase command at least 3 times until an erase error is not generated when an erase error is generated. figure 17.7.5.1. flow chart of block erase command (when not using erase suspend function) 17.7.5 block erase by writing xx20 16 in the first bus cycle and xxd0 16 in the second bus cycle to the highest-order (even addresse of a block) and the auto-programming/erasing (erase and erase verify) start. the fmr00 bit in the fmr0 register indicates whether the auto-programming operation has been completed. the fmr00 bit is set to 0 (busy) during the auto-erasing operation and 1 (ready) when the auto-erasing operation is completed. when using the erase-suspend function in ew0 mode, the fmr46 bit in the fmr4 register indicates whether a flash memory has entered erase-suspend mode. the fmr46 bit is set to 0 during auto-erasing operation and 1 when the auto-erasing operation is completed (enter- ing erase-suspend). after the completion of an auto-erasing operation, the fmr07 bit in the fmr0 register indicates whether or not the auto erasing-operation has been completed as expected. (refer to 17.8.4 full status check ). also, each block disables erasing. (refer to table 17.5.2.1 ). figure 17.7.5.1 shows a flow chart of the block erase command programming when not using the erase- suspend function. figure 17.7.5.2 shows a flow chart of the block erase command programming when using an erase-suspend function. in ew1 mode, do not execute this command on the block where the rewrite control program is allocated. in ew0 mode, the microcomputer enters read status register mode as soon as the auto-erasing operation starts and the status register can be read. the sr7 bit in the status register is set to 0 as soon as the auto-erasing operation starts. this bit is set to 1 when the auto-erasing operation is completed. the microcomputer remains in read status register mode until the read array command is written. also excute the clear status register command and block erase command at least 3 times until an erase error is not generated when an erase error is gener- ated.
17. flash memory version page 250 9 2 3 f o 7 0 0 2 , 5 1 . b e f 0 0 . 2 . v e r 0 0 2 0 - 2 0 2 0 b 9 0 j e r ) t 6 2 / c 6 1 m , b 6 2 / c 6 1 m , a 6 2 / c 6 1 m ( p u o r g a 6 2 / c 6 1 m start block erase completed write the command code xx20 16 (1) write xxd0 16 to the highest-order block address (1) yes no fmr00=1? full status check (2,4) fmr40=1 interrupt service routine (3) fmr41=1 yes no fmr46=1? access flash memory return (interrupt service routine end) fmr41=0 (ew0 mode) (ew1 mode) start block erase completed write the command code xx20 16 (1) write xxd0 16 to the highest-order block address (1) yes no fmr00=1? full status check (2,4) fmr40=1 fmr41=0 interrupt service routine (3) access flash memory return (interrupt service routine end) notes: 1. write the command code and data to even address. 2. execute the clear status register command and block erase command at least 3 times until an erase error is not generated when an erase error is generated. 3. in ew0 mode, allocate an interrupt vector table of an interrupt, to be used, to a ram area. 4. refer to " figure 17.8.4.1 full status check and handling procedure for each error ." figure 17.7.5.2. block erase command (at use erase suspend)
17. flash memory version page 251 9 2 3 f o 7 0 0 2 , 5 1 . b e f 0 0 . 2 . v e r 0 0 2 0 - 2 0 2 0 b 9 0 j e r ) t 6 2 / c 6 1 m , b 6 2 / c 6 1 m , a 6 2 / c 6 1 m ( p u o r g a 6 2 / c 6 1 m bits in the srd register sr4 (d 4 ) sr5 (d 5 ) sr7 (d 7 ) sr6 (d 6 ) status name contents sr1 (d 1 ) sr2 (d 2 ) sr3 (d 3 ) sr0 (d 0 ) program status erase status sequence status reserved reserved reserved reserved "1" ready terminated by error terminated by error - - - - - "0" busy completed normally completed normally - - - - - reserved bits in the fmr0 register fmr00 fmr07 fmr06 value after reset 1 0 0 table 17.8.1. status register 17.8 status register the status register indicates the operating status of the flash memory and whether an erasing or a pro- gramming operates normally and an error ends. the fmr00, fmr06, and fmr07 bits in the fmr0 register indicate the status of the status register. table 17.8.1 shows the status register. in ew0 mode, the status register can be read in the following cases: (1) when a given even address in the user rom area is read after writing the read status register command (2) when a given even address in the user rom area is read after executing the program or block erase command but before executing the read a rray command. 17.8.1 sequence status (sr7 and fmr00 bits ) the sequence status indicates the operating status of the flash memory. this bit is set to 0 (busy) during an auto-programming and auto-erasing and 1 (ready) as soon as these operations are com- pleted. this bit indicates 0 (busy) in erase-suspend mode. 17.8.2 erase status (sr5 and fmr07 bits) refer to 17.8.4 full status check . 17.8.3 program status (sr4 and fmr06 bits) refer to 17.8.4 full status check . ? d 7 to d 0 : indicates the data bus which is read out when executing the read status register command. ? the fmr07 bit (sr5) and fmr06 bit (sr4) are set to 0 by executing the clear status register command. ? when the fmr07 bit (sr5) or fmr06 bit (sr4) is 1, the program, and block erase command are not acknowledged.
17. flash memory version page 252 9 2 3 f o 7 0 0 2 , 5 1 . b e f 0 0 . 2 . v e r 0 0 2 0 - 2 0 2 0 b 9 0 j e r ) t 6 2 / c 6 1 m , b 6 2 / c 6 1 m , a 6 2 / c 6 1 m ( p u o r g a 6 2 / c 6 1 m 17.8.4 full status check when an error occurs, the fmr06 to fmr07 bits in the fmr0 register are set to 1 , indicating occur- rence of each specific error. therefore, execution results can be verified by checking these status bits (full status check). table 17.8.4.1 shows errors and the status of fmr0 register. figure 17.8.4.1 shows a flow chart of the full status check and handling procedure for each error. table 17.8.4.1. errors and fmr0 register status fmr0 register (srd register) status error error occurrence condition fmr07 fmr06 (sr5) (sr4) 1 1 command ? when any commands are not written correctly sequence error ? a value other than xxd0 16 or xxff 16 is written in the second bus cycle of the block erase command (1) ? when the block erase command is executed on protected blocks ? when the program command is executed on protected blocks 1 0 erase error ? when the block erase command is executed on unprotected blocks but the blocks are not automatically erased correctly 0 1 program error ? when the program command is executed on unprotected blocks but the blocks are not automatically programmed correctly. note: 1. the flash memory enters read array mode by writing command code xxff 16 in the second bus cycle of these commands. the command code written in the first bus cycle becomes invalid.
17. flash memory version page 253 9 2 3 f o 7 0 0 2 , 5 1 . b e f 0 0 . 2 . v e r 0 0 2 0 - 2 0 2 0 b 9 0 j e r ) t 6 2 / c 6 1 m , b 6 2 / c 6 1 m , a 6 2 / c 6 1 m ( p u o r g a 6 2 / c 6 1 m full status check fmr06 =1 and fmr07=1? no command sequence error yes fmr07=0? yes erase error no (1) execute the clear status register command and set the status flag to 0 whether the command is entered. (2) reexecute the command after checking that it is entered correctly or the program command or the block erase command is not executed for the blocks which are protected. (1) execute the clear status register command and set the erase status flag to 0 . (2) reexecute the block erase command. (3) execute (1) and (2) at least 3 times until an erase error is not generated. note 3: if the fmr06 or fmr07 bits is 1 , any of the program or block erase command can not be aknowledged. execute the clear status register command before executing those commands. fmr06=0? yes program error no full status check completed note 1: if the error still occurs, the block can not be used. (1) execute the clear status register command and set the program status flag to 0 . (2) reexecute the program command. note 2: if the error still occurs, the block can not be used. [during programming] figure 17.8.4.1. full status check and handling procedure for each error
17. flash memory version page 254 9 2 3 f o 7 0 0 2 , 5 1 . b e f 0 0 . 2 . v e r 0 0 2 0 - 2 0 2 0 b 9 0 j e r ) t 6 2 / c 6 1 m , b 6 2 / c 6 1 m , a 6 2 / c 6 1 m ( p u o r g a 6 2 / c 6 1 m 17.9 standard serial i/o mode in standard serial input/output mode, the user rom area can be rewritten while the microcomputer is mounted on-board by using a serial programmer which is applicable for the m16c/26a group. for more information about serial programmers, contact the manufacturer of your serial programmer. for details on how to use the serial programmer, refer to the user s manual included with your serial programmer. table 17.9.1 shows pin functions (flash memory standard serial input/output mode). figures 17.9.1 and 17.9.2 show pin connections for standard serial input/output mode. 17.9.1 id code check function this function determines whether the id codes sent from the serial programmer and those written in the flash memory match. (refer to 17.3 functions to prevent flash memory from rewriting. )
17. flash memory version page 255 9 2 3 f o 7 0 0 2 , 5 1 . b e f 0 0 . 2 . v e r 0 0 2 0 - 2 0 2 0 b 9 0 j e r ) t 6 2 / c 6 1 m , b 6 2 / c 6 1 m , a 6 2 / c 6 1 m ( p u o r g a 6 2 / c 6 1 m table 17.9.1. pin functions (flash memory standard serial i/o mode) notes: 1. when using standard serial input/output mode 1, to input h to the txd pin is necessary while the ___________ reset pin is l . therefore, connect this pin to v cc via a resistor. adjust the pull-up resistor value on a system not to affect a data transfer after reset, because this pin changes to a data-output pin 2. set following either or both _____ ? connect the ce pin to v cc . _____ ? connect the rp pin to v ss and the p1 6 pin to v cc . pin descriptio n v cc ,v ss apply the voltage guaranteed for program and erase to vcc pin and 0 v to vss pin. cnv ss connect to vcc pin. reset x in connect a ceramic resonator or crystal oscillator between x in and x out pins. to input an externally generated clock, input it to x in pin and open x out pin. x out av cc , av ss v ref connect avss to vss and avcc to vcc, respectively. enter the reference voltage for ad from this pin. p1 5 , p1 7 input "h" or "l" level signal or open. p6 0 to p6 3 input "h" or "l" level signal or open. p6 4 standard serial i/o mode 1: busy signal output pin standard serial i/o mode 2: monitor signal output pin for boot program operation check p6 5 p6 6 serial data input pin p6 7 serial data output pin p7 0 to p7 7 input "h" or "l" level signal or open. p8 0 to p8 4 , p8 7 input "h" or "l" level signal or open. p9 0 to p9 3 , input "h" or "l" level signal or open. p10 0 to p10 7 input "h" or "l" level signal or open. name power input cnv ss reset input clock input clock output analog power supply input reference voltage input input port p1 input port p6 busy output sclk input rxd input txd output input port p7 input port p8 input port p9 input port p10 i/o i i i o i i i o i i o i i i i p8 5 rp input i connect this pin to vss while reset is low. (2) standard serial i/o mode 1: serial clock input pin standard serial i/o mode 2: input "l". reset input pin. while reset pin is "l" level, wait for td(roc) . (1) p8 6 ce input i connect this pin to vcc while reset is low. (2) p1 6 p1 6 input connect this pin to vcc while reset is low. (2) i
17. flash memory version page 256 9 2 3 f o 7 0 0 2 , 5 1 . b e f 0 0 . 2 . v e r 0 0 2 0 - 2 0 2 0 b 9 0 j e r ) t 6 2 / c 6 1 m , b 6 2 / c 6 1 m , a 6 2 / c 6 1 m ( p u o r g a 6 2 / c 6 1 m figure 17.9.1. pin connections for serial i/o mode (1) m16c/26a group (m16c/26a) (flash memory version) prsp0042ga-b (42p2r) 31 32 3 3 34 3 5 36 37 38 39 4 0 4 1 4 2 1 2 11 1 0 9 8 7 6 5 4 3 2 1 1 6 15 1 4 13 27 28 29 30 busy sclk rxd txd vcc vss reset connect oscillator circuit mode setup method signal cnvss reset value vcc vss to vcc ce (1) rp (1) 17 2 1 2 0 19 18 2 6 2 2 23 2 4 25 note: 1. set following either or both in serial i/o mode while the reset pin is held l . ? ?
17. flash memory version page 257 9 2 3 f o 7 0 0 2 , 5 1 . b e f 0 0 . 2 . v e r 0 0 2 0 - 2 0 2 0 b 9 0 j e r ) t 6 2 / c 6 1 m , b 6 2 / c 6 1 m , a 6 2 / c 6 1 m ( p u o r g a 6 2 / c 6 1 m figure 17.9.2. pin connections for serial i/o mode (2) m16c/26a group (m16c/26a, m16c/26b, m16c/26t) (flash memory version) plqp0048kb-a (48p6q) 1 2 3 4 5 6 7 8 9 10 11 12 13 1 4 1 5 1 6 17 1 8 19 2 0 2 1 2 2 2 3 2 4 36 35 34 33 32 31 30 29 28 27 26 25 4 8 4 7 4 6 4 5 4 4 43 4 2 4 1 4 0 39 3 8 37 mode setup method signal cnvss reset value vcc vss to vcc busy sclk rxd txd connect oscillator circuit vcc vss reset ce (1) rp (1) p1 6 (1) note: 1. set following either or both in serial i/o mode while the reset pin is held l . ? ?
17. flash memory version page 258 9 2 3 f o 7 0 0 2 , 5 1 . b e f 0 0 . 2 . v e r 0 0 2 0 - 2 0 2 0 b 9 0 j e r ) t 6 2 / c 6 1 m , b 6 2 / c 6 1 m , a 6 2 / c 6 1 m ( p u o r g a 6 2 / c 6 1 m 17.9.2 example of circuit application in standard serial i/o mode figure 17.9.2.1 shows an example of a circuit application in standard serial i/o mode 1 and figure 17.9.2.2 shows an example of a circuit application in standard serial i/o mode 2. refer to the user's manual for a serial writer to handle pins controlled by the serial writer. figure 17.9.2.1. circuit application in standard serial i/o mode 1 sclk input busy output txd output rxd input busy sclk t x d cnvss p8 6 (ce) reset rxd reset input user reset singnal microcomputer (1) controlling pins and external circuits vary with the serial programmer. for more information, refer to the user's manual included with the serial programmer. (2) in this example, a selector controls the input voltage applied to cnvss to switch between single-chip mode and standard serial i/o mode. (3) in standard serial input/output mode 1, if the user reset signal becomes l while the microcomputer is communicating with the serial programmer, break the connection between the user reset signal and the reset pin using a jumper switch. p8 5 (rp) (1) (1) note: 1. set following either or both ? connect the ce pin to v cc ? connect the rp pin to v ss and the p1 6 pin to v cc p1 6 (1)
17. flash memory version page 259 9 2 3 f o 7 0 0 2 , 5 1 . b e f 0 0 . 2 . v e r 0 0 2 0 - 2 0 2 0 b 9 0 j e r ) t 6 2 / c 6 1 m , b 6 2 / c 6 1 m , a 6 2 / c 6 1 m ( p u o r g a 6 2 / c 6 1 m monitor output rxd input txd output busy sclk txd cnvss p8 6 (ce) rxd microcomputer (1) in this example, a selector controls the input voltage applied to cnvss to switch between single-chip mode and standard serial i/o mode. p8 5 (rp) (1) (1) note: 1. set following either or both ? connect the ce pin to v cc ? connect the rp pin to v ss and the p1 6 pin to v cc p1 6 (1) figure 17.9.2.2. circuit application in standard serial i/o mode 2
17. flash memory version page 260 9 2 3 f o 7 0 0 2 , 5 1 . b e f 0 0 . 2 . v e r 0 0 2 0 - 2 0 2 0 b 9 0 j e r ) t 6 2 / c 6 1 m , b 6 2 / c 6 1 m , a 6 2 / c 6 1 m ( p u o r g a 6 2 / c 6 1 m 17.10 parallel i/o mode in parallel input/output mode, the user rom can be rewritten using a parallel programmer which is appli- cable for the m16c/26a group. for more information about the parallel programmer, contact your parallel programmer manufacturer. for details on how to use the parallel programmer, refer to the user s manual of the parallel programmer. 17.10.1 rom code protect function the rom code protect function prevents the flash memory from being read or rewritten. (refer to 17.3 function to prevent flash memory from rewriting .)
18. electrical characteristics (m16c/26a, m16c/26b) page 261 9 2 3 f o 7 0 0 2 , 5 1 . b e f 0 0 . 2 . v e r 0 0 2 0 - 2 0 2 0 b 9 0 j e r ) t 6 2 / c 6 1 m , b 6 2 / c 6 1 m , a 6 2 / c 6 1 m ( p u o r g a 6 2 / c 6 1 m 18. electrical characteristics please contact renesas technology corp. or an authorized renesas technology corp. product distributor for electrical characteristics of v-ver. 18.1. m16c/26a, m16c/26b (normal version) table 18.1. absolute maximum ratings l o b m y sr e t e m a r a pn o i t i d n o ce u l a vt i n u v c c e g a t l o v y l p p u sv c c v a = c c 5 . 6 o t 3 . 0 -v v a c c e g a t l o v y l p p u s g o l a n av c c v a = c c 5 . 6 o t 3 . 0 -v v i e g a t l o v t u p n i1 p 5 1 p o t 7 6 p , 0 6 p o t 7 7 p , 0 7 p o t 7 , 8 p 0 8 p o t 7 9 p , 0 9 p o t 3 0 1 p , 0 0 1 p o t 7 , x n i v , f e r v n c , t e s e r , s s v o t 3 . 0 - c c 3 . 0 +v v o e g a t l o v t u p t u o1 p 5 1 p o t 7 6 p , 0 6 p o t 7 7 p , 0 7 p o t 7 , 8 p 0 8 p o t 7 9 p , 0 9 p o t 3 0 1 p , 0 0 1 p o t 7 , x t u o v o t 3 . 0 - c c 3 . 0 +v d pn o i t a p i s s i d r e w o p0 4 -< r p o t< c 5 80 0 3w m r p o tg n i t a r e p o t n e i b m a e r u t a r e p m e t n o i t a r e p o u p c g n i r u d / 5 8 o t 0 2 - 5 8 o t 0 4 - ) 1 ( c y r o m e m h s a l f g n i r u d e s a r e d n a m a r g o r p n o i t a r e p o e c a p s m a r g o r p ) 3 k c o l b o t 0 k c o l b ( 0 6 o t 0c e c a p s a t a d ) b k c o l b , a k c o l b ( / 0 6 o t 0 / 5 8 o t 0 2 - 5 8 o t 0 4 - ) 1 ( c g t s te r u t a r e p m e t e g a r o t s 0 5 1 o t 5 6 -c note: 1. refer to tables 1.7 and 1.8 .
18. electrical characteristics (m16c/26a, m16c/26b) page 262 9 2 3 f o 7 0 0 2 , 5 1 . b e f 0 0 . 2 . v e r 0 0 2 0 - 2 0 2 0 b 9 0 j e r ) t 6 2 / c 6 1 m , b 6 2 / c 6 1 m , a 6 2 / c 6 1 m ( p u o r g a 6 2 / c 6 1 m table 18.2. recommended operating conditions ( 1) l o b m y sr e t e m a r a p d r a d n a t s t i n u . n i m. p y t. x a m v c c e g a t l o v y l p p u s 7 . 25 . 5v v a c c e g a t l o v y l p p u s g o l a n a v c c v v s s e g a t l o v y l p p u s 0v v a s s e g a t l o v y l p p u s g o l a n a 0v v h i ) " h " ( h g i h t u p n i e g a t l o v 1 p 5 1 p o t 7 6 p , 0 6 p o t 7 7 p , 0 7 p o t 7 , 8 p 0 8 p o t 7 9 p , 0 9 p o t 3 0 1 p , 0 0 1 p o t 7 v 7 . 0 c c v c c v s s v n c , t e s e r , n i x v 8 . 0 c c v c c v v l i ) " l " ( w o l t u p n i e g a t l o v 1 p 5 1 p o t 7 6 p , 0 6 p o t 7 7 p , 0 7 p o t 7 , 8 p 0 8 p o t 7 9 p , 0 9 p o t 3 0 1 p , 0 0 1 p o t 7 0v 3 . 0 c c v s s v n c , t e s e r , n i x 0v 2 . 0 c c v i ) k a e p ( h o h g i h t u p t u o k a e p t n e r r u c ) " h " ( 1 p 5 1 p o t 7 6 p , 0 6 p o t 7 7 p , 0 7 p o t 7 , 8 p 0 8 p o t 7 9 p , 0 9 p o t 3 0 1 p , 0 0 1 p o t 7 0 . 0 1 -a m i ) g v a ( h o t u p t u o e g a r e v a t n e r r u c ) " h " ( h g i h 1 p 5 1 p o t 7 6 p , 0 6 p o t 7 7 p , 0 7 p o t 7 , 8 p 0 8 p o t 7 9 p , 0 9 p o t 3 0 1 p , 0 0 1 p o t 7 0 . 5 -a m i ) k a e p ( l o w o l t u p t u o k a e p t n e r r u c ) " l " ( 1 p 5 1 p o t 7 6 p , 0 6 p o t 7 7 p , 0 7 p o t 7 , 8 p 0 8 p o t 7 9 p , 0 9 p o t 3 0 1 p , 0 0 1 p o t 7 0 . 0 1a m i ) g v a ( l o t u p t u o e g a r e v a t n e r r u c ) " l " ( w o l 1 p 5 1 p o t 7 6 p , 0 6 p o t 7 7 p , 0 7 p o t 7 , 8 p 0 8 p o t 7 9 p , 0 9 p o t 3 0 1 p , 0 0 1 p o t 7 0 . 5a m x ( f n i )y c n e u q e r f n o i t a l l i c s o t u p n i k c o l c n i a m ) 4 ( v c c v 5 . 5 o t 0 . 3 = 00 2z h m v c c v 0 . 3 o t 7 . 2 =0v x 3 3 c c 0 8 -z h m x ( f n i c )y c n e u q e r f n o i t a l l i c s o k c o l c b u s 8 6 7 . 2 30 5z h k f 1 ) c o r (1 y c n e u q e r f r o t a l l i c s o p i h c - n o 5 . 01 2 z h m ) c o r ( 2 f2 y c n e u q e r f r o t a l l i c s o p i h c - n o 12 4 z h m ) c o r ( 3 f3 y c n e u q e r f r o t a l l i c s o p i h c - n o 86 16 2z h m ) l l p ( fy c n e u q e r f n o i t a l l i c s o k c o l c l l p ) 4 ( v c c ) b 6 2 / c 6 1 m ( v 5 . 5 o t 2 . 4 =0 14 2z h m v c c ) b 6 2 / c 6 1 m ( v 2 . 4 o t 0 . 3 =0 1v x 3 3 . 3 + c c 0 1z h m v c c ) a 6 2 / c 6 1 m ( v 5 . 5 o t 0 . 3 =0 10 2z h m v c c v 0 . 3 o t 7 . 2 =0 1v x 3 3 c c 0 8 -z h m ) k l c b ( fy c n e u q e r f k c o l c n o i t a r e p o u p c a 6 2 / c 6 1 m00 2z h m b 6 2 / c 6 1 m04 2z h m t u s ) l l p (y c n e u q e r f l l p e z i l i b a t s o t e m i t t i a w r e z i s e h t n y s v c c v 0 . 5 =0 2s m v c c v 0 . 3 =0 5s m : s e t o n v o t d e c n e r e f e r . 1 c c . d e i f i c e p s e s i w r e h t o s s e l n u c 5 8 o t 0 4 - / c 5 8 o t 0 2 - = r p o t t a v 5 . 5 o t 7 . 2 = . s m 0 0 1 n i h t i w e u l a v n a e m e h t s i t n e r r u c t u p t u o n a e m e h t . 2 i l a t o t e h t . 3 ) k a e p ( l o i l a t o t e h t . s s e l r o a m 0 8 e b t s u m s t r o p l l a r o f ) k a e p ( h o . s s e l r o a m 0 8 - e b t s u m s t r o p l l a r o f . e g a t l o v y l p p u s d n a y c n e u q e r f n o i t a l l i c s o k c o l c l l p , y c n e u q e r f n o i t a l l i c s o k c o l c n i a m g n o m a p i h s n o i t a l e r . 4 main clock input oscillation frequency f(x in ) operating maximum frequency [mh z ] v cc [v] (main clock: no division) pll clock oscillation frequency (m16c/26a) f(pll) operating maximum frequency [mh z ] v cc [v] (pll clock oscillation) aaaaa aaaaa aaaaa aaaaa aaaaa aaaaa 20.0 0.0 5.5 3.0 10.0 2.7 33.3 x v cc -80 mh z 20.0 0.0 5.5 10.0 2.7 3.0 33.3 x v cc -80 mh z 20.0 0.0 5.5 10.0 2.7 3.0 33.3 x v cc -80 mh z 4.2 24.0 aaaaa aaaaa aaaaa aaaaa aaaaa aaaaa aaaaa 3.33 x v cc +10 mh z pll clock oscillation frequency (m16c/26b) v cc [v] (pll clock oscillation) f(pll) operating maximum frequency [mh z ]
18. electrical characteristics (m16c/26a, m16c/26b) page 263 9 2 3 f o 7 0 0 2 , 5 1 . b e f 0 0 . 2 . v e r 0 0 2 0 - 2 0 2 0 b 9 0 j e r ) t 6 2 / c 6 1 m , b 6 2 / c 6 1 m , a 6 2 / c 6 1 m ( p u o r g a 6 2 / c 6 1 m table 18.3. a /d conversion characteristics ( 1) l o b m y sr e t e m a r a pn o i t i d n o c t n e m e r u s a e m d r a d n a t s t i n u . n i m. p y t. x a m -n o i t u l o s e rv f e r v = c c 0 1s t i b l n i y t i r a e n i l n o n l a r g e t n i r o r r e t i b 0 1 v f e r v = c c v 5 =3 b s l v f e r v = c c v 3 . 3 =5 b s l t i b 8v f e r v = c c v 5 , v 3 . 3 =2 b s l -y c a r u c c a e t u l o s b a t i b 0 1 v f e r v = c c v 5 =3 b s l v f e r v = c c v 3 . 3 =5 b s l t i b 8v f e r v = c c v 5 , v 3 . 3 =2 b s l l n dr o r r e y t i r a e n i l n o n l a i t n e r e f f i d 1 b s l -r o r r e t e s f f o 3 b s l -r o r r e n i a g 3 b s l r r e d d a l r e d d a l r o t s i s e rv = f e r v c c 0 10 4k ? 5 8 o t 0 4 - / c 5 8 o t 0 2 - = r p o t t a v 0 = . d e i f i c e p s p e e k . 2
18. electrical characteristics (m16c/26a, m16c/26b) page 264 9 2 3 f o 7 0 0 2 , 5 1 . b e f 0 0 . 2 . v e r 0 0 2 0 - 2 0 2 0 b 9 0 j e r ) t 6 2 / c 6 1 m , b 6 2 / c 6 1 m , a 6 2 / c 6 1 m ( p u o r g a 6 2 / c 6 1 m table 18.4. flash memory version electrical characteristic (1) : program space and data space for u3 and u5, program space for u7 and u9 table 18.5. flash memory version electrical characteristics (6) : data space for u7 and u9 (7) erase suspend request (interrupt request) fmr46 td(sr-es) l o b m y sr e t e m a r a p d r a d n a t s t i n u . n i m. p y t ) 2 ( . x a m - e c n a r u d n e e s a r e d n a m a r g o r p ) 3 ( 0 0 0 1 / 0 0 1 ) 1 1 , 4 ( s e l c y c -v ( e m i t m a r g o r p d r o w c c 5 2 = r p o t , v 0 . 5 =c )5 70 0 6 ) k c o l b e t y b k - 2 2 . 09s k c o l b e t y b k - 8 4 . 09s k c o l b e t y b k - 6 1 7 . 09s k c o l b e t y b k - 2 3 2 . 19s ) s e - r s ( d td n e p s u s e s a r e d n a t s e u q e r d n e p s u s n e e w t e b n o i t a r u d 8s m t s p t i u c r i c y r o m e m h s a l f e z i l i b a t s o t e m i t t i a w 5 1 )0 0 1 ) ) k c o l b e t y b k - 2 ( 3 . 0s ) s e - r s ( d td n e p s u s e s a r e d n a t s e u q e r d n e p s u s n e e w t e b n o i t a r u d 8s m t s p t i u c r i c y r o m e m h s a l f e z i l i b a t s o t e m i t t i a w 5 1 0 6 o t 0 = r p o t t a v 5 . 5 o t 7 . 2 = s s e l n u , ) e c a p s a t a d ( c 5 8 o t 0 4 - , ) e c a p s m a r g o r p ( c . d e i f i c e p s e s i w r e h t o v . 2 c c t ; v 0 . 5 = r p o c 5 2 = . k c o l b r e p s e l c y c e s a r e - m a r g o r p f o r e b m u n s a d e n i f e d s i e c n a r u d n e e s a r e d n a m a r g o r p . 3 s i e c n a r u d n e e s a r e d n a m a r g o r p f i n ( e l c y c n d e m m a r g o r p d n a d e s a r e e b n a c k c o l b h c a e , ) 0 0 0 0 1 , 0 0 0 1 , 0 0 1 = n . s e l c y c , s e m i t 4 2 0 , 1 s s e r d d a h c a e o t a t a d d r o w - e n o g n i m m a r g o r p r e t f a d e s a r e s i a k c o l b e t y b k - 2 a f i , e l p m a x e r o f n a h t e r o m s s e r d d a e m a s e h t o t d e m m a r g o r p e b t o n n a c a t a d . e c n a r u d n e e s a r e d n a m a r g o r p e n o s a s t n u o c s i h t . ) d e t i b i h o r p e t i r w e r ( . k c o l b e h t g n i s a r e t u o h t i w e c n o . ) d e e t n a r a u g e r a e u l a v m u m i n i m o t 1 ( d e e t n a r u g s i n o i t a r e p o h c i h w r o f s e l c y c w / e f o r e b m u n . 4 t . 5 r p o c 5 5 = v o t d e c n e r e f e r . 6 c c t t a v 5 . 5 o t 7 . 2 = r p o . d e i f i c e p s e s i w r e h t o s s e l n u ) 9 u ( c 5 8 o t 0 2 - / ) 7 u ( c 5 8 o t 0 4 - = . s e l c y c 0 0 0 , 1 n a h t e r o m s i e c n a r u d n e e s a r e d n a m a r g o r p n e h w 9 u d n a 7 u n i e c a p s a t a d r o f s e i l p p a 5 . 8 1 e l b a t . 7 . 4 . 8 1 e l b a t e s u , e s i w r e h t o , s e t i r w e r s u o r e m u n g n i r i u q e r s m e t s y s h t i w g n i k r o w n e h w e c n a r u d n e e s a r e d n a m a r g o r p f o r e b m u n e h t e c u d e r o t . 8 s e s s e r d d a e l b i s s o p l l a r e t f a y l n o k c o l b e s a r e . e t i r w e r f o d a e t s n i k c o l b e h t n i h t i w s e s s e r d d a d r o w d e s u n u o t e t i r w . y r a s s e c e n s e m o c e b e s a r e e r o f e b m u m i x a m s e m i t 8 2 1 n e t t i r w e b n a c m a r g o r p d r o w - 8 n a , e l p m a x e r o f . d e s u e r a s i t i . y c n e i c i f f e e v o r p m i o s l a l l i w b k c o l b d n a a k c o l b n e e w t e b e r u s a r e s e m i t f o r e b m u n l a u q e n a g n i n i a t n i a m . e r u s a r e f o r e b m u n e h t t i m i l o t d n a k c o l b r e p d e m r o f r e p e r u s a r e f o r e b m u n l a t o t e h t k c a r t o t d e d n e m m o c e r t o n s i r o r r e e s a r e n a l i t n u s e m i t 3 t s a e l t a d n a m m o c e s a r e k c o l b d n a d n a m m o c r e t s i g e r s u t a t s r a e l c e h t e t u c e x e . 9 . d e t a r e n e g s i r o r r e e s a r e n a n e h w d e t a r e n e g n i t i b 7 1 r m f e h t g n i t t e s y b s s e c c a k c o l b r e p e t a t s t i a w e n o t e s , s e t i r w e r s e m i t 0 0 1 n a h t e r o m g n i t u c e x e n e h w . 0 1 e b n a c e t a t s t i a w , m a r l a n r e t n i d n a s k c o l b r e h t o l l a o t g n i s s e c c a n e h w . ) e t a t s t i a w ( " 1 " o t 1 r e t s i g e r 1 r m f e h t . e u l a v g n i t t e s t i b 7 1 r m f e h t f o s s e l d r a g e r , t i b 7 1 m p e h t y b t e s 0 0 0 , 1 ; 5 u d n a 3 u n i e c a p s a t a d d n a e c a p s m a r g o r p r o f s e l c y c 0 0 1 s i e c n a r u d n e e s a r e d n a m a r g o r p e h t . 1 1 . 9 u d n a 7 u n i e c a p s m a r g o r p r o f s e l c y c . e v i t a t n e s e r p e r t r o p p u s l a c i n h c e t s a s e n e r r i e h t t c a t n o c d l u o h s n o i t a m r o f n i e t a r e r u l i a f w / e g n i r i s e d s r e m o t s u c . 2 1
18. electrical characteristics (m16c/26a, m16c/26b) page 265 9 2 3 f o 7 0 0 2 , 5 1 . b e f 0 0 . 2 . v e r 0 0 2 0 - 2 0 2 0 b 9 0 j e r ) t 6 2 / c 6 1 m , b 6 2 / c 6 1 m , a 6 2 / c 6 1 m ( p u o r g a 6 2 / c 6 1 m table 18.6. voltage detection circuit electrical characteristics (1, 3 ) table 18.7. power supply circuit timing characteristics l o b m y sr e t e m a r a pn o i t i d n o c t n e m e r u s a e m d r a d n a t s t i n u . n i m. p y t. x a m 4 t e d ve g a t l o v n o i t c e t e d e g a t l o v w o l ) 1 ( v c c v 5 . 5 o t 8 . 0 = 2 . 38 . 35 4 . 4v 3 t e d ve g a t l o v n o i t c e t e d l e v e l t e s e r ) 1 ( 3 . 28 . 24 . 3v s 3 t e d v e g a t l o v d l o h t e s e r e g a t l o v w o l ) 2 ( 7 . 1v r 3 t e d ve g a t l o v e s a e l e r t e s e r e g a t l o v w o l 5 3 . 29 . 25 . 3v : s e t o n 3 t e d v > 4 t e d v . 1 . " 2 t e s e r e r a w d r a h " n i a t n i a m o t e g a t l o v m u m n i m e h t s i s 3 t e d v . 2 v n e h w e s u o t d e n g i s e d s i t i u c r i c n o i t c e t e d e g a t l o v e h t . 3 c c . v 5 o t t e s s i n o i t c e t e d l e v e l t e s e r e h t n e h w e g a t l o v n o i t c e t e d l e v e l t e s e r e h t n a h t r e t a e r g s i e g a t l o v r e w o p y l p p u s e h t f i . 4 ) k l c b ( f t a n o i t a r e p o e h t , v 7 . 2 n a h t s s e l s i e g a t l o v
18. electrical characteristics (m16c/26a, m16c/26b) page 266 9 2 3 f o 7 0 0 2 , 5 1 . b e f 0 0 . 2 . v e r 0 0 2 0 - 2 0 2 0 b 9 0 j e r ) t 6 2 / c 6 1 m , b 6 2 / c 6 1 m , a 6 2 / c 6 1 m ( p u o r g a 6 2 / c 6 1 m v cc = 5v table 18.8. electrical characteristics ( 1) l o b m y sr e t e m a r a pn o i t i d n o c d r a d n a t s t i n u . n i m. p y t. x a m v h o h g i h t u p t u o e g a t l o v ) " h " ( 1 p 5 1 p o t 7 6 p , 0 6 p o t 7 7 p , 0 7 p o t 7 , 8 p 0 8 p o t 7 9 p , 0 9 p o t 3 0 1 p , 0 0 1 p o t 7 i h o a m 5 - = v c c - 0 . 2 v c c v v h o h g i h t u p t u o e g a t l o v ) " h " ( 1 p 5 1 p o t 7 6 p , 0 6 p o t 7 7 p , 0 7 p o t 7 , 8 p 0 8 p o t 7 9 p , 0 9 p o t 3 0 1 p , 0 0 1 p o t 7 i h o 0 0 2 - = ? ? ? 5 8 o t 0 4 - / c 5 8 o t 0 2 - = r p o t t a v 0 = . d e i f i c e p s
18. electrical characteristics (m16c/26a, m16c/26b) page 267 9 2 3 f o 7 0 0 2 , 5 1 . b e f 0 0 . 2 . v e r 0 0 2 0 - 2 0 2 0 b 9 0 j e r ) t 6 2 / c 6 1 m , b 6 2 / c 6 1 m , a 6 2 / c 6 1 m ( p u o r g a 6 2 / c 6 1 m v cc = 5v table 18.9. electrical characteristics (2) ( 1) l o b m y sr e t e m a r a pn o i t i d n o c t n e m e r u s a e m d r a d n a t s t i n u . n i m. p y t. x a m i c c y l p p u s r e w o p t n e r r u c v ( c c ) v 5 . 5 o t 0 . 4 = e r a s n i p t u p t u o d n a n e p o t f e l e r a s n i p r e h t o v o t d e t c e n n o c s s m o r k s a m, z h m 0 2 = ) k l c b ( f n o i s i v i d o n , k c o l c n i a m 2 17 1a m n o i t a l l i c s o p i h c - n o f ) c o r ( 2 z h m 1 = ) k l c b ( f , d e t c e l e s 1a m y r o m e m h s a l f, z h m 4 2 = ) k l c b ( f ) b 6 2 / c 6 1 m ( s e t a r e p o l l p 0 23 2a m , k c o l c n i a m , z h m 0 2 = ) k l c b ( f n o i s i v i d o n 6 19 1a m , s e t a r e p o r o t a l l i c s o p i h c - n o f ) c o r ( 2 z h m 1 = ) k l c b ( f , d e t c e l e s 1a m y r o m e m h s a l f m a r g o r p v 0 . 5 = c c v , z h m 0 1 = ) k l c b ( f 1 1a m y r o m e m h s a l f e s a r e v 0 . 5 = c c v , z h m 0 1 = ) k l c b ( f 2 1a m m o r k s a m, z h k 2 3 = ) k l c b ( f , e d o m n o i t p m u s n o c r e w o p - w o l n i m o r n o g n i n n u r m a r g o r p ) 3 ( 5 2 8 . 03 5 8 o t 0 4 - / c 5 8 o t 0 2 - = r p o t t a v 0 = . d e i f i c e p s f g n i s u , s e t a r e p o r e m i t e n o h t i w . 2 2 3 c . . s t s i x e d e t u c e x e e b o t m a r g o r p e h t h c i h w n i y r o m e m e h t s e t a c i d n i s i h t . 3 . ) d e l b a n e t i u c r i c n o i t c e t e d ( " 1 " o t t e s s i t i b g n i w o l l o f e h t n e h w t n e r r u c n o i t a p i s s i d s i t e d i . 4 r e t s i g e r 2 r c v e h t n i t i b 7 2 c v : 4 t e d i r e t s i g e r 2 r c v e h t n i t i b 6 2 c v : 3 t e d i
18. electrical characteristics (m16c/26a, m16c/26b) page 268 9 2 3 f o 7 0 0 2 , 5 1 . b e f 0 0 . 2 . v e r 0 0 2 0 - 2 0 2 0 b 9 0 j e r ) t 6 2 / c 6 1 m , b 6 2 / c 6 1 m , a 6 2 / c 6 1 m ( p u o r g a 6 2 / c 6 1 m v cc = 5v timing requirements (v cc = 5v, v ss = 0v, at topr = 20 to 85 o c / 40 to 85 o c unless otherwise specified) table 18.10. external clock input (x in input) l o b m y sr e t e m a r a p d r a d n a t s t i n u . n i m. x a m c te m i t e l c y c t u p n i k c o l c l a n r e t x e 0 5s n w t ) h ( h t d i w ) " h " ( h g i h t u p n i k c o l c l a n r e t x e 0 2s n w t ) l ( h t d i w ) " l " ( w o l t u p n i k c o l c l a n r e t x e 0 2s n r te m i t e s i r k c o l c l a n r e t x e 9s n f te m i t l l a f k c o l c l a n r e t x e 9s n
18. electrical characteristics (m16c/26a, m16c/26b) page 269 9 2 3 f o 7 0 0 2 , 5 1 . b e f 0 0 . 2 . v e r 0 0 2 0 - 2 0 2 0 b 9 0 j e r ) t 6 2 / c 6 1 m , b 6 2 / c 6 1 m , a 6 2 / c 6 1 m ( p u o r g a 6 2 / c 6 1 m v cc = 5v timing requirements (v cc = 5v, v ss = 0v, at topr = 20 to 85 o c / 40 to 85 o c unless otherwise specified) table 18.12. timer a input (gating input in timer mode) table 18.13. timer a input (external trigger input in one-shot timer mode) table 18.14. timer a input (external trigger input in pulse width modulation mode) table 18.15. timer a input (counter increment/decrement input in event counter mode) table 18.11. timer a input (counter input in event counter mode) table 18.16. timer a input (two-phase pulse input in event counter mode) standard max. ns tai in input low pulse width t w(tal) min. ns ns unit tai in input high pulse width t w(tah) parameter symbol t c(ta) tai in input cycle time 40 100 40 standard max. min. ns ns ns unit tai in input cycle time tai in input high pulse width tai in input low pulse width t c(ta) t w(tah) t w(tal) symbol parameter 400 200 200 standard max. min. ns ns ns unit tai in input cycle time tai in input high pulse width tai in input low pulse width t c(ta) t w(tah) t w(tal) symbol parameter 200 100 100 standard max. min. ns ns unit t w(tah) t w(tal) symbol parameter tai in input high pulse width tai in input low pulse width 100 100 standard max. min. ns ns ns unit ns ns symbol parameter tai out input cycle time tai out input high pulse width tai out input low pulse width tai out input setup time tai out input hold time t c(up) t w(uph) t w(upl) t su(up-t in ) t h(t in- up) 2000 1000 1000 400 400 standard max. min. ns ns ns unit symbol parameter tai in input cycle time tai out input setup time tai in input setup time t c(ta) t su(ta in -ta out ) t su(ta out -ta in ) 800 200 200
18. electrical characteristics (m16c/26a, m16c/26b) page 270 9 2 3 f o 7 0 0 2 , 5 1 . b e f 0 0 . 2 . v e r 0 0 2 0 - 2 0 2 0 b 9 0 j e r ) t 6 2 / c 6 1 m , b 6 2 / c 6 1 m , a 6 2 / c 6 1 m ( p u o r g a 6 2 / c 6 1 m timing requirements (v cc = 5v, v ss = 0v, at topr = 20 to 85 o c / 40 to 85 o c unless otherwise specified) table 18.17. timer b input (counter input in event counter mode) table 18.18. timer b input (pulse period measurement mode) table 18.19. timer b input (pulse width measurement mode) table 18.20. a/d trigger input table 18.21. serial i/o _______ table 18.22. external interrupt inti input v cc = 5v ns ns ns ns ns ns ns standard max. min. tbi in input cycle time (counted on one edge) tbi in input high pulse width (counted on one edge) tbi in input low pulse width (counted on one edge) ns ns ns t c(tb) t w(tbh) t w(tbl) parameter symbol unit t c(tb) t w(tbl) t w(tbh) ns ns ns tbi in input high pulse width (counted on both edges) tbi in input low pulse width (counted on both edges) tbi in input cycle time (counted on both edges) standard max. min. ns ns t c(tb) t w(tbh) symbol parameter unit t w(tbl) ns tbi in input high pulse width tbi in input cycle time tbi in input low pulse width standard max. min. ns ns t c(tb) symbol parameter unit t w(tbl) ns t w(tbh) tbi in input cycle time tbi in input high pulse width tbi in input low pulse width standard max. min. ns ns t c(ad) t w(adl) symbol parameter unit ad trg input cycle time (trigger able minimum) ad trg input low pulse width standard max. min. ns ns t w(inh) t w(inl) symbol parameter unit inti input low pulse width inti input high pulse width standard max. min. clki input cycle time clki input high pulse width clki input low pulse width t c(ck) t w(ckh) t w(ckl) parameter symbol unit t d(c-q) t su(d-c) t h(c-q) txdi hold time rxdi input setup time txdi output delay time t h(c-d) rxdi input hold time 100 40 40 80 80 200 400 200 200 400 200 200 1000 125 250 250 200 100 100 0 70 90 80
18. electrical characteristics (m16c/26a, m16c/26b) page 271 9 2 3 f o 7 0 0 2 , 5 1 . b e f 0 0 . 2 . v e r 0 0 2 0 - 2 0 2 0 b 9 0 j e r ) t 6 2 / c 6 1 m , b 6 2 / c 6 1 m , a 6 2 / c 6 1 m ( p u o r g a 6 2 / c 6 1 m v cc = 5v taiin input taiout input during event counter mode tbiin input adtrg input t c(ta) t w(tah) t w(tal) t c(up) t w(uph) t w(upl) t c(tb) t w(tbh) t w(tbl) t c(ad) t w(adl) t h(tin-up) t su(up-tin) taiin input (when count on falling edge is selected) taiin input (when count on rising edge is selected) taiout input (up/down input) taiin input two-phase pulse input in event counter mode t c(ta) t su(tain-taout) t su(taout-tain) t su(tain-taout) t su(taout-tain) taiout input xin input t w(h) t w(l) t r t f t c figure 18.1. timing diagram (1)
18. electrical characteristics (m16c/26a, m16c/26b) page 272 9 2 3 f o 7 0 0 2 , 5 1 . b e f 0 0 . 2 . v e r 0 0 2 0 - 2 0 2 0 b 9 0 j e r ) t 6 2 / c 6 1 m , b 6 2 / c 6 1 m , a 6 2 / c 6 1 m ( p u o r g a 6 2 / c 6 1 m v cc = 5v figure 18.2. timing diagram (2) t su(d C c) clki txdi rxdi t c(ck) t w(ckh) t w(ckl) t w(inl) t w(inh) t d(c C q) t h(c C d) t h(c C q) inti input
18. electrical characteristics (m16c/26a, m16c/26b) page 273 9 2 3 f o 7 0 0 2 , 5 1 . b e f 0 0 . 2 . v e r 0 0 2 0 - 2 0 2 0 b 9 0 j e r ) t 6 2 / c 6 1 m , b 6 2 / c 6 1 m , a 6 2 / c 6 1 m ( p u o r g a 6 2 / c 6 1 m v cc = 3v table 18.23. electrical characteristics ( 1) l o b m y sr e t e m a r a pn o i t i d n o c d r a d n a t s t i n u . n i m. p y t. x a m v h o h g i h t u p t u o e g a t l o v ) " h " ( 1 p 5 1 p o t 7 6 p , 0 6 p o t 7 7 p , 0 7 p o t 7 , 8 p 0 8 p o t 7 9 p , 0 9 p o t 3 0 1 p , 0 0 1 p o t 7 i h o a m 1 - = v c c - 5 . 0 v c c v v h o e g a t l o v ) " h " ( h g i h t u p t u ox t u o r e w o p h g i h i h o a m 1 . 0 - = v c c - 5 . 0 v c c v r e w o p w o l i h o 0 5 - = ? ? ? 5 8 o t 0 4 - / c 5 8 o t 0 2 - = r p o t t a v 0 = . d e i f i c e p s
18. electrical characteristics (m16c/26a, m16c/26b) page 274 9 2 3 f o 7 0 0 2 , 5 1 . b e f 0 0 . 2 . v e r 0 0 2 0 - 2 0 2 0 b 9 0 j e r ) t 6 2 / c 6 1 m , b 6 2 / c 6 1 m , a 6 2 / c 6 1 m ( p u o r g a 6 2 / c 6 1 m v cc = 3v table 18.24. electrical characteristics (2) ( 1) l o b m y sr e t e m a r a pn o i t i d n o c t n e m e r u s a e m d r a d n a t s t i n u . n i m. p y t. x a m i c c y l p p u s r e w o p t n e r r u c v ( c c ) v 6 . 3 o t 7 . 2 = e r a s n i p t u p t u o d n a n e p o t f e l e r a s n i p r e h t o v o t d e t c e n n o c s s m o r k s a m( fk l c b, z h m 0 1 = ) n o i s i v i d o n , k c o l c n i a m 70 1a m , s e t a r e p o r o t a l l i c s o p i h c - n o f ) c o r ( 2 z h m 1 = ) k l c b ( f , d e t c e l e s 1a m y r o m e m h s a l f( fk l c b, z h m 0 1 = ) n o i s i v i d o n , k c o l c n i a m 72 1a m , s e t a r e p o r o t a l l i c s o p i h c - n o f ) c o r ( 2 z h m 1 = ) k l c b ( f , d e t c e l e s 1a m y r o m e m h s a l f m a r g o r p v 0 . 3 = c c v , z h m 0 1 = ) k l c b ( f 0 1a m y r o m e m h s a l f e s a r e v 0 . 3 = c c v , z h m 0 1 = ) k l c b ( f 1 1a m m o r k s a mz h k 2 3 = ) k l c b ( f, e d o m n o i t p m u s n o c r e w o p - w o l n i, m o r n o g n i n n u r m a r g o r p ) 3 ( 5 2 7 . 03 5 8 o t 0 4 - / c 5 8 o t 0 2 - = r p o t t a v 0 = . d e i f i c e p s f g n i s u , s e t a r e p o r e m i t e n o h t i w . 2 2 3 c . . s t s i x e d e t u c e x e e b o t m a r g o r p e h t h c i h w n i y r o m e m e h t s e t a c i d n i s i h t . 3 . ) d e l b a n e t i u c r i c n o i t c e t e d ( 1 o t t e s s i t i b g n i w o l l o f e h t n e h w t n e r r u c n o i t a p i s s i d s i t e d i . 4 r e t s i g e r 2 r c v e h t f o t i b 7 2 c v e h t : 4 t e d i r e t s i g e r 2 r c v e h t n i t i b 6 2 c v e h t : 3 t e d i
18. electrical characteristics (m16c/26a, m16c/26b) page 275 9 2 3 f o 7 0 0 2 , 5 1 . b e f 0 0 . 2 . v e r 0 0 2 0 - 2 0 2 0 b 9 0 j e r ) t 6 2 / c 6 1 m , b 6 2 / c 6 1 m , a 6 2 / c 6 1 m ( p u o r g a 6 2 / c 6 1 m v cc = 3v timing requirements (v cc = 3v, v ss = 0v, at topr = 20 to 85 o c / 40 to 85 o c unless otherwise specified) table 18.25. external clock input (x in input) l o b m y sr e t e m a r a p d r a d n a t s t i n u . n i m. x a m c te m i t e l c y c t u p n i k c o l c l a n r e t x e 0 0 1s n w t ) h ( h t d i w ) " h " ( h g i h t u p n i k c o l c l a n r e t x e 0 4s n w t ) l ( h t d i w ) " l " ( w o l t u p n i k c o l c l a n r e t x e 0 4s n r te m i t e s i r k c o l c l a n r e t x e 8 1s n f te m i t l l a f k c o l c l a n r e t x e 8 1s n
18. electrical characteristics (m16c/26a, m16c/26b) page 276 9 2 3 f o 7 0 0 2 , 5 1 . b e f 0 0 . 2 . v e r 0 0 2 0 - 2 0 2 0 b 9 0 j e r ) t 6 2 / c 6 1 m , b 6 2 / c 6 1 m , a 6 2 / c 6 1 m ( p u o r g a 6 2 / c 6 1 m v cc = 3v timing requirements (v cc = 3v, v ss = 0v, at topr = 20 to 85 o c / 40 to 85 o c unless otherwise specified) table 18.26. timer a input (counter input in event counter mode) table 18.27. timer a input (gating input in timer mode) table 18.28. timer a input (external trigger input in one-shot timer mode) table 18.29. timer a input (external trigger input in pulse width modulation mode) table 18.30. timer a input (counter increment/decrement input in event counter mode) table 18.31. timer a input (two-phase pulse input in event counter mode) standard max. ns tai in input low pulse width t w(tal) min. ns ns unit tai in input high pulse width t w(tah) parameter symbol t c(ta) tai in input cycle time 60 150 60 standard max. min. ns ns ns unit tai in input cycle time tai in input high pulse width tai in input low pulse width t c(ta) t w(tah) t w(tal) symbol parameter 600 300 300 standard max. min. ns ns ns unit tai in input cycle time tai in input high pulse width tai in input low pulse width t c(ta) t w(tah) t w(tal) symbol parameter 300 150 150 standard max. min. ns ns unit t w(tah) t w(tal) symbol parameter tai in input high pulse width tai in input low pulse width 150 150 standard max. min. ns ns ns unit ns ns symbol parameter tai out input cycle time tai out input high pulse width tai out input low pulse width tai out input setup time tai out input hold time t c(up) t w(uph) t w(upl) t su(up-t in ) t h(t in- up) 3000 1500 1500 600 600 standard max. min. s ns ns unit symbol parameter tai in input cycle time tai out input setup time tai in input setup time t c(ta) t su(ta in -ta out ) t su(ta out -ta in ) 2 500 500
18. electrical characteristics (m16c/26a, m16c/26b) page 277 9 2 3 f o 7 0 0 2 , 5 1 . b e f 0 0 . 2 . v e r 0 0 2 0 - 2 0 2 0 b 9 0 j e r ) t 6 2 / c 6 1 m , b 6 2 / c 6 1 m , a 6 2 / c 6 1 m ( p u o r g a 6 2 / c 6 1 m v cc = 3v table 18.32. timer b input (counter input in event counter mode) table 18.33. timer b input (pulse period measurement mode) table 18.34. timer b input (pulse width measurement mode) table 18.35. a/d trigger input table 18.36. serial i/o _______ table 18.37. external interrupt inti input timing requirements (v cc = 3v, v ss = 0v, at topr = 20 to 85 o c / 40 to 85 o c unless otherwise specified) ns ns ns ns ns ns ns standard ma x. min. tbi in input cycle time (counted on one edge) tbi in input high pulse width (counted on one edge) tbi in input low pulse width (counted on one edge) ns ns ns t c(tb) t w(tbh) t w(tbl) paramete r symbo l uni t t c(tb) t w(tbl) t w(tbh) ns ns ns tbi in input high pulse width (counted on both edges) tbi in input low pulse width (counted on both edges) tbi in input cycle time (counted on both edges) standard max. min. ns ns t c(tb) t w(tbh) symbol parameter unit t w(tbl) ns tbi in input high pulse width tbi in input cycle time tbi in input low pulse width standar d ma x. mi n. ns ns t c(tb) symbol parameter unit t w(tbl) ns t w(tbh) tbi in input cycle time tbi in input high pulse width tbi in input low pulse width standar d ma x. mi n. ns ns t c(ad) t w(adl) symbo l paramete r unit ad trg input cycle time (trigger able minimum) ad trg input low pulse width standard ma x. min. ns ns t w(inh) t w(inl) symbo l paramete r unit inti input low pulse width inti input high pulse width standard max. mi n. clki input cycle time clki input high pulse width clki input low pulse width t c(ck) t w(ckh) t w(ckl) parameter symbol unit t d(c-q) t su(d-c) t h(c-q) txdi hold time rxdi input setup time txdi output delay time t h(c-d) rxdi input hold time 150 60 60 120 120 300 600 300 300 600 300 300 1500 200 380 380 300 150 150 0 100 90 160
18. electrical characteristics (m16c/26a, m16c/26b) page 278 9 2 3 f o 7 0 0 2 , 5 1 . b e f 0 0 . 2 . v e r 0 0 2 0 - 2 0 2 0 b 9 0 j e r ) t 6 2 / c 6 1 m , b 6 2 / c 6 1 m , a 6 2 / c 6 1 m ( p u o r g a 6 2 / c 6 1 m v cc = 3v figure 18.3. timing diagram (1) taiin input taiout input during event counter mode tbiin input adtrg input t c(ta) t w(tah) t w(tal) t c(up) t w(uph) t w(upl) t c(tb) t w(tbh) t w(tbl) t c(ad) t w(adl) t h(tin-up) t su(up-tin) taiin input (when count on falling edge is selected) taiin input (when count on rising edge is selected) taiout input (up/down input) taiin input two-phase pulse input in event counter mode t c(ta) t su(tain-taout) t su(taout-tain) t su(tain-taout) t su(taout-tain) taiout input xin input t w(h) t w(l) t r t f t c
18. electrical characteristics (m16c/26a, m16c/26b) page 279 9 2 3 f o 7 0 0 2 , 5 1 . b e f 0 0 . 2 . v e r 0 0 2 0 - 2 0 2 0 b 9 0 j e r ) t 6 2 / c 6 1 m , b 6 2 / c 6 1 m , a 6 2 / c 6 1 m ( p u o r g a 6 2 / c 6 1 m v cc = 3v figure 18.4. timing diagram (2) t su(d C c) clki txdi rxdi t c(ck) t w(ckh) t w(ckl) t w(inl) t w(inh) t d(c C q) t h(c C d) t h(c C q) inti input
18. electrical characteristics (m16c/26t) page 280 9 2 3 f o 7 0 0 2 , 5 1 . b e f 0 0 . 2 . v e r 0 0 2 0 - 2 0 2 0 b 9 0 j e r ) t 6 2 / c 6 1 m , b 6 2 / c 6 1 m , a 6 2 / c 6 1 m ( p u o r g a 6 2 / c 6 1 m 18.2. m16c/26t (t version) table 18.38. absolute maximum ratings l o b m y sr e t e m a r a pn o i t i d n o ce u l a vt i n u v c c e g a t l o v y l p p u sv c c v a = c c 5 . 6 o t 3 . 0 - v v a c c e g a t l o v y l p p u s g o l a n av c c v a = c c 5 . 6 o t 3 . 0 - v v i e g a t l o v t u p n i1 p 5 1 p o t 7 6 p , 0 6 p o t 7 7 p , 0 7 p o t 7 , 8 p 0 8 p o t 7 9 p , 0 9 p o t 3 0 1 p , 0 0 1 p o t 7 , x n i v , f e r v n c , t e s e r , s s v o t 3 . 0 - c c 3 . 0 +v v o e g a t l o v t u p t u o1 p 5 1 p o t 7 6 p , 0 6 p o t 7 7 p , 0 7 p o t 7 , 8 p 0 8 p o t 7 9 p , 0 9 p o t 3 0 1 p , 0 0 1 p o t 7 , x t u o v o t 3 . 0 - c c 3 . 0 +v d pn o i t a p i s s i d r e w o p0 4 -< r p o t< c 5 80 0 3w m r p o t g n i t a r e p o t n e i b m a e r u t a r e p m e t n o i t a r e p o u p c g n i r u d 5 8 o t 0 4 -c y r o m e m h s a l f g n i r u d e s a r e d n a m a r g o r p n o i t a r e p o e c a p s m a r g o r p ) 3 k c o l b o t 0 k c o l b ( 0 6 o t 0c e c a p s a t a d ) b k c o l b , a k c o l b ( 5 8 o t 0 4 -c g t s te r u t a r e p m e t e g a r o t s 0 5 1 o t 5 6 -c
18. electrical characteristics (m16c/26t) page 281 9 2 3 f o 7 0 0 2 , 5 1 . b e f 0 0 . 2 . v e r 0 0 2 0 - 2 0 2 0 b 9 0 j e r ) t 6 2 / c 6 1 m , b 6 2 / c 6 1 m , a 6 2 / c 6 1 m ( p u o r g a 6 2 / c 6 1 m table 18.39. recommended operating conditions ( 1) main clock input oscillation frequency 20.0 0.0 f(x in ) operating maximum frequency [mh z ] v cc [v] (main clock: no division) 5.5 3.0 10.0 2.7 aaaaa aaaaa aaaaa aaaaa aaaaa aaaaa 20mh z pll clock oscillation frequency 20.0 0.0 f(pll) operating maximum frequency [mh z ] v cc [v] (pll clock oscillation) 5.5 10.0 aaaaa aaaaa aaaaa 3.0 20mh z l o b m y sr e t e m a r a p d r a d n a t s t i n u . n i m. p y t. x a m v c c e g a t l o v y l p p u s 0 . 35 . 5v v a c c e g a t l o v y l p p u s g o l a n a v c c v v s s e g a t l o v y l p p u s 0v v a s s e g a t l o v y l p p u s g o l a n a 0v v h i ) " h " ( h g i h t u p n i e g a t l o v 1 p 5 1 p o t 7 6 p , 0 6 p o t 7 7 p , 0 7 p o t 7 , 8 p 0 8 p o t 7 9 p , 0 9 p o t 3 0 1 p , 0 0 1 p o t 7 v 7 . 0 c c v c c v s s v n c , t e s e r , n i x v 8 . 0 c c v c c v v l i ) " l " ( w o l t u p n i e g a t l o v 1 p 5 1 p o t 7 6 p , 0 6 p o t 7 7 p , 0 7 p o t 7 , 8 p 0 8 p o t 7 9 p , 0 9 p o t 3 0 1 p , 0 0 1 p o t 7 0v 3 . 0 c c v s s v n c , t e s e r , n i x 0v 2 . 0 c c v i ) k a e p ( h o h g i h t u p t u o k a e p t n e r r u c ) " h " ( 1 p 5 1 p o t 7 6 p , 0 6 p o t 7 7 p , 0 7 p o t 7 , 8 p 0 8 p o t 7 9 p , 0 9 p o t 3 0 1 p , 0 0 1 p o t 7 0 . 0 1 -a m i ) g v a ( h o t u p t u o e g a r e v a t n e r r u c ) " h " ( h g i h 1 p 5 1 p o t 7 6 p , 0 6 p o t 7 7 p , 0 7 p o t 7 , 8 p 0 8 p o t 7 9 p , 0 9 p o t 3 0 1 p , 0 0 1 p o t 7 0 . 5 -a m i ) k a e p ( l o w o l t u p t u o k a e p t n e r r u c ) " l " ( 1 p 5 1 p o t 7 6 p , 0 6 p o t 7 7 p , 0 7 p o t 7 , 8 p 0 8 p o t 7 9 p , 0 9 p o t 3 0 1 p , 0 0 1 p o t 7 0 . 0 1a m i ) g v a ( l o t u p t u o e g a r e v a t n e r r u c ) " l " ( w o l 1 p 5 1 p o t 7 6 p , 0 6 p o t 7 7 p , 0 7 p o t 7 , 8 p 0 8 p o t 7 9 p , 0 9 p o t 3 0 1 p , 0 0 1 p o t 7 0 . 5a m x ( f n i )y c n e u q e r f n o i t a l l i c s o t u p n i k c o l c n i a m ) 4 ( 00 2z h m x ( f n i c )y c n e u q e r f n o i t a l l i c s o k c o l c b u s 8 6 7 . 2 30 5z h k f 1 ) c o r (1 y c n e u q e r f r o t a l l i c s o p i h c - n o 5 . 01 2 z h m ) c o r ( 2 f2 y c n e u q e r f r o t a l l i c s o p i h c - n o 12 4 z h m ) c o r ( 3 f3 y c n e u q e r f r o t a l l i c s o p i h c - n o 86 16 2z h m ) l l p ( fy c n e u q e r f n o i t a l l i c s o k c o l c l l p ) 4 ( 0 10 2z h m ) k l c b ( fy c n e u q e r f k c o l c n o i t a r e p o u p c 00 2z h m t u s ) l l p (r e z i s e h t n y s y c n e u q e r f l l p e z i l i b a t s o t e m i t t i a wv c c v 0 . 5 =0 2s m v c c v 0 . 3 =0 5s m : s e t o n v o t d e c n e r e f e r . 1 c c . d e i f i c e p s e s i w r e h t o s s e l n u c 5 8 o t 0 4 - = r p o t t a v 5 . 5 o t 0 . 3 = . s m 0 0 1 n i h t i w e u l a v n a e m e h t s i t n e r r u c t u p t u o n a e m e h t . 2 i l a t o t e h t . 3 ) k a e p ( l o i l a t o t e h t . s s e l r o a m 0 8 e b t s u m s t r o p l l a r o f ) k a e p ( h o . s s e l r o a m 0 8 - e b t s u m s t r o p l l a r o f . e g a t l o v y l p p u s d n a y c n e u q e r f n o i t a l l i c s o k c o l c l l p , y c n e u q e r f n o i t a l l i c s o k c o l c n i a m g n o m a p i h s n o i t a l e r . 4
18. electrical characteristics (m16c/26t) page 282 9 2 3 f o 7 0 0 2 , 5 1 . b e f 0 0 . 2 . v e r 0 0 2 0 - 2 0 2 0 b 9 0 j e r ) t 6 2 / c 6 1 m , b 6 2 / c 6 1 m , a 6 2 / c 6 1 m ( p u o r g a 6 2 / c 6 1 m table 18.40. a/d conversion characteristics ( 1) l o b m y sr e t e m a r a pn o i t i d n o c t n e m e r u s a e m d r a d n a t s t i n u . n i m. p y t. x a m -n o i t u l o s e rv f e r v = c c 0 1s t i b l n i y t i r a e n i l n o n l a r g e t n i r o r r e t i b 0 1 v f e r v = c c v 5 =3 b s l v f e r v = c c v 3 . 3 =5 b s l t i b 8v f e r v = c c v 5 , v 3 . 3 =2 b s l -y c a r u c c a e t u l o s b a t i b 0 1 v f e r v = c c v 5 =3 b s l v f e r v = c c v 3 . 3 =5 b s l t i b 8v f e r v = c c v 5 , v 3 . 3 =2 b s l l n dr o r r e y t i r a e n i l n o n l a i t n e r e f f i d 1 b s l -r o r r e t e s f f o 3 b s l -r o r r e n i a g 3 b s l r r e d d a l r e d d a l r o t s i s e rv f e r =v c c 0 10 4k ? 5 8 o t 0 4 - = r p o t t a v 0 = . d e i f i c e p s p e e k . 2
18. electrical characteristics (m16c/26t) page 283 9 2 3 f o 7 0 0 2 , 5 1 . b e f 0 0 . 2 . v e r 0 0 2 0 - 2 0 2 0 b 9 0 j e r ) t 6 2 / c 6 1 m , b 6 2 / c 6 1 m , a 6 2 / c 6 1 m ( p u o r g a 6 2 / c 6 1 m table 18.41. flash memory version electrical characteristics (1) : program space and data space for u3, program space for u7 table 18.42. flash memory version electrical characteristics (6) : data space for u7 (7) erase suspend request (interrupt request) fmr46 td(sr-es) l o b m y sr e t e m a r a p d r a d n a t s t i n u . n i m. p y t ) 2 ( . x a m - e c n a r u d n e e s a r e d n a m a r g o r p ) 3 ( 0 0 0 1 / 0 0 1 ) 1 1 , 4 ( s e l c y c -v ( e m i t m a r g o r p d r o w c c 5 2 = r p o t , v 0 . 5 =c )5 70 0 6 ) k c o l b e t y b k - 2 2 . 09s k c o l b e t y b k - 8 4 . 09s k c o l b e t y b k - 6 1 7 . 09s k c o l b e t y b k - 2 3 2 . 19s ) s e - r s ( d td n e p s u s e s a r e d n a t s e u q e r d n e p s u s n e e w t e b n o i t a r u d 8s m t s p t i u c r i c y r o m e m h s a l f e z i l i b a t s o t e m i t t i a w 5 1 )0 0 1 ) ) k c o l b e t y b k - 2 ( 3 . 0s ) s e - r s ( d td n e p s u s e s a r e d n a t s e u q e r d n e p s u s n e e w t e b n o i t a r u d 8s m t s p t i u c r i c y r o m e m h s a l f e z i l i b a t s o t e m i t t i a w 5 1 0 6 o t 0 = r p o t t a v 5 . 5 o t 0 . 3 = c c v o t d e c n e r e f e r . 1 s s e l n u , ) e c a p s a t a d ( c 5 8 o t 0 4 - = r p o t / ) e c a p s m a r g o r p ( c . d e i f i c e p s e s i w r e h t o v . 2 c c t ; v 0 . 5 = r p o c 5 2 = . k c o l b r e p s e l c y c e s a r e - m a r g o r p f o r e b m u n s a d e n i f e d s i e c n a r u d n e e s a r e d n a m a r g o r p . 3 s i e c n a r u d n e e s a r e d n a m a r g o r p f i n ( e l c y c n d e m m a r g o r p d n a d e s a r e e b n a c k c o l b h c a e , ) 0 0 0 0 1 , 0 0 0 1 , 0 0 1 = n . s e l c y c , s e m i t 4 2 0 , 1 s s e r d d a h c a e o t a t a d d r o w - e n o g n i m m a r g o r p r e t f a d e s a r e s i a k c o l b e t y b k - 2 a f i , e l p m a x e r o f n a h t e r o m s s e r d d a e m a s e h t o t d e m m a r g o r p e b t o n n a c a t a d . e c n a r u d n e e s a r e d n a m a r g o r p e n o s a s t n u o c s i h t . ) d e t i b i h o r p e t i r w e r ( . k c o l b e h t g n i s a r e t u o h t i w e c n o . ) d e e t n a r u g e r a e u l a v m u m i n i m o t 1 ( d e e t n a r u g s i n o i t a r e p o h c i h w r o f s e l c y c w / e f o r e b m u n . 4 c 5 5 = r p o t . 5 . d e i f i c e p s e s i w r e h t o s s e l n u c 5 8 o t 0 4 - = r p o t t a v 5 . 5 o t 0 . 3 = c c v o t d e c n e r e f e r . 6 . 7 2 4 . 8 1 e l b a t . s e l c y c 0 0 0 , 1 n a h t e r o m s i e c n a r u d n e e s a r e d n a m a r g o r p n e h w 7 u n i e c a p s a t a d r o f s e i l p p a e s u , e s i w r e h t o 1 4 . 8 1 e l b a t . , s e t i r w e r s u o r e m u n g n i r i u q e r s m e t s y s h t i w g n i k r o w n e h w e c n a r u d n e e s a r e d n a m a r g o r p f o r e b m u n e h t e c u d e r o t . 8 s e s s e r d d a e l b i s s o p l l a r e t f a y l n o k c o l b e s a r e . e t i r w e r f o d a e t s n i k c o l b e h t n i h t i w s e s s e r d d a d r o w d e s u n u o t e t i r w . y r a s s e c e n s e m o c e b e s a r e e r o f e b m u m i x a m s e m i t 8 2 1 n e t t i r w e b n a c m a r g o r p d r o w - 8 n a , e l p m a x e r o f . d e s u e r a s i t i . y c n e i c i f f e e v o r p m i o s l a l l i w b k c o l b d n a a k c o l b n e e w t e b e r u s a r e s e m i t f o r e b m u n l a u q e n a g n i n i a t n i a m . e r u s a r e f o r e b m u n e h t t i m i l o t d n a k c o l b r e p d e m r o f r e p e r u s a r e f o r e b m u n l a t o t e h t k c a r t o t d e d n e m m o c e r e s a r e k c o l b d n a d n a m m o c r e t s i g e r s u t a t s r a e l c e h t e t u c e x e , e s a r e k c o l b g n i r u d d e t a r e n e g s i r o r r e e s a r e n a f i . 9 . d e t a r e n e g t o n s i r o r r e e s a r e n a l i t n u s e m i t 3 t s a e l t a d n a m m o c n i t i b 7 1 r m f e h t g n i t t e s y b s s e c c a k c o l b r e p e t a t s t i a w e n o t e s , s e t i r w e r s e m i t 0 0 1 n a h t e r o m g n i t u c e x e n e h w . 0 1 t e s e b n a c e t a t s t i a w , m a r l a n r e t n i d n a s k c o l b r e h t o l l a o t g n i s s e c c a n e h w . ) e t a t s t i a w ( 1 o t r e t s i g e r 1 r m f e h t . e u l a v g n i t t e s t i b 7 1 r m f e h t f o s s e l d r a g e r , t i b 7 1 m p e h t y b s e l c y c 0 0 0 , 1 ; 3 u n i e c a p s a t a d d n a e c a p s m a r g o r p r o f s e l c y c 0 0 1 s i e c n a r u d n e e s a r e d n a m a r g o r p e h t . 1 1 . 7 u n i e c a p s m a r g o r p r o f r o f r o t u b i r t s i d t c u d o r p . p r o c y g o l o n h c e t s a s e n e r d e z i r o h t u a n a r o . p r o c y g o l o n h c e t s a s e n e r t c a t n o c e s a e l p . 2 1 . e t a r e r u l i a f w / e e h t n o s l i a t e d r e h t r u f
18. electrical characteristics (m16c/26t) page 284 9 2 3 f o 7 0 0 2 , 5 1 . b e f 0 0 . 2 . v e r 0 0 2 0 - 2 0 2 0 b 9 0 j e r ) t 6 2 / c 6 1 m , b 6 2 / c 6 1 m , a 6 2 / c 6 1 m ( p u o r g a 6 2 / c 6 1 m table 18.43. power supply circuit timing characteristics l o b m y sr e t e m a r a pn o i t i d n o c t n e m e r u s a e m d r a d n a t s t i n u . n i m. p y t. x a m ) r - p ( d tn o - r e w o p n e h w e g a t l o v y l p p u s l a n r e t n i e z i l i b a t s o t e m i t t i a w v c c v 5 . 5 o t 0 . 3 = 2s m ) c o r ( d t n o - r e w o p n e h w r o t a l l i c s o p i h c - n o l a n r e t n i e z i l i b a t s o t e m i t t i a w 0 4
18. electrical characteristics (m16c/26t) page 285 9 2 3 f o 7 0 0 2 , 5 1 . b e f 0 0 . 2 . v e r 0 0 2 0 - 2 0 2 0 b 9 0 j e r ) t 6 2 / c 6 1 m , b 6 2 / c 6 1 m , a 6 2 / c 6 1 m ( p u o r g a 6 2 / c 6 1 m v cc = 5v table 18.44. electrical characteristics ( 1) l o b m y sr e t e m a r a pn o i t i d n o c d r a d n a t s t i n u . n i m. p y t. x a m v h o h g i h t u p t u o e g a t l o v ) " h " ( 1 p 5 1 p o t 7 6 p , 0 6 p o t 7 7 p , 0 7 p o t 7 , 8 p 0 8 p o t 7 9 p , 0 9 p o t 3 0 1 p , 0 0 1 p o t 7 i h o a m 5 - = v c c - 0 . 2 v c c v v h o h g i h t u p t u o e g a t l o v ) " h " ( 1 p 5 1 p o t 7 6 p , 0 6 p o t 7 7 p , 0 7 p o t 7 , 8 p 0 8 p o t 7 9 p , 0 9 p o t 3 0 1 p , 0 0 1 p o t 7 i h o 0 0 2 - = ? ? ? 5 8 o t 0 4 - = r p o t t a v 0 =
18. electrical characteristics (m16c/26t) page 286 9 2 3 f o 7 0 0 2 , 5 1 . b e f 0 0 . 2 . v e r 0 0 2 0 - 2 0 2 0 b 9 0 j e r ) t 6 2 / c 6 1 m , b 6 2 / c 6 1 m , a 6 2 / c 6 1 m ( p u o r g a 6 2 / c 6 1 m v cc = 5v table 18.45. electrical characteristics (2) ( 1) l o b m y sr e t e m a r a pn o i t i d n o c t n e m e r u s a e m d r a d n a t s t i n u . n i m. p y t. x a m i c c y l p p u s r e w o p t n e r r u c v ( c c ) v 5 . 5 o t 0 . 4 = e r a s n i p t u p t u o d n a n e p o t f e l e r a s n i p r e h t o v o t d e t c e n n o c s s y r o m e m h s a l f( fk l c b, z h m 0 2 = ) n o i s i v i d o n , k c o l c n i a m 6 19 1a m , s e t a r e p o r o t a l l i c s o p i h c - n o f ) c o r ( 2 z h m 1 = ) k l c b ( f , d e t c e l e s 1a m y r o m e m h s a l f m a r g o r p v 0 . 5 = c c v , z h m 0 1 = ) k l c b ( f 1 1a m y r o m e m h s a l f e s a r e v 0 . 5 = c c v , z h m 0 1 = ) k l c b ( f 2 1a m y r o m e m h s a l fz h k 2 3 = ) k l c b ( f, e d o m n o i t p m u s n o c r e w o p - w o l n i, m a r n o g n i n n u r m a r g o r p ) 3 ( 5 2 8 . 03 5 8 o t 0 4 - = r p o t t a v 0 = f g n i s u , s e t a r e p o r e m i t e n o h t i w . 2 2 3 c . . s t s i x e d e t u c e x e e b o t m a r g o r p e h t h c i h w n i y r o m e m e h t s e t a c i d n i s i h t . 3
18. electrical characteristics (m16c/26t) page 287 9 2 3 f o 7 0 0 2 , 5 1 . b e f 0 0 . 2 . v e r 0 0 2 0 - 2 0 2 0 b 9 0 j e r ) t 6 2 / c 6 1 m , b 6 2 / c 6 1 m , a 6 2 / c 6 1 m ( p u o r g a 6 2 / c 6 1 m v cc = 5v timing requirements (v cc = 5v, v ss = 0v, at topr = 40 to 85 o c unless otherwise specified) table 18.46. external clock input (x in input) max. external clock rise time ns t r min. external clock input cycle time external clock input high pulse width external clock input low pulse width external clock fall time ns ns ns ns t c t w(h ) t w(l) t f parameter symbol unit standard 50 20 20 9 9
18. electrical characteristics (m16c/26t) page 288 9 2 3 f o 7 0 0 2 , 5 1 . b e f 0 0 . 2 . v e r 0 0 2 0 - 2 0 2 0 b 9 0 j e r ) t 6 2 / c 6 1 m , b 6 2 / c 6 1 m , a 6 2 / c 6 1 m ( p u o r g a 6 2 / c 6 1 m v cc = 5v timing requirements (v cc = 5v, v ss = 0v, at topr = 40 to 85 o c unless otherwise specified) table 18.48. timer a input (gating input in timer mode) table 18.49. timer a input (external trigger input in one-shot timer mode) table 18.50. timer a input (external trigger input in pulse width modulation mode) table 18.51. timer a input (counter increment/decrement input in event counter mode) table 18.47. timer a input (counter input in event counter mode) table 18.52. timer a input (two-phase pulse input in event counter mode) standard max. ns tai in input low pulse width t w(tal) min. ns ns unit tai in input high pulse width t w(tah) parameter symbol t c(ta) tai in input cycle time 40 100 40 standard max. min. ns ns ns unit tai in input cycle time tai in input high pulse width tai in input low pulse width t c(ta) t w(tah) t w(tal) symbol parameter 400 200 200 standard max. min. ns ns ns unit tai in input cycle time tai in input high pulse width tai in input low pulse width t c(ta) t w(tah) t w(tal) symbol parameter 200 100 100 standard max. min. ns ns unit t w(tah) t w(tal) symbol parameter tai in input high pulse width tai in input low pulse width 100 100 standard max. min. ns ns ns unit ns ns symbol parameter tai out input cycle time tai out input high pulse width tai out input low pulse width tai out input setup time tai out input hold time t c(up) t w(uph) t w(upl) t su(up-t in ) t h(t in- up) 2000 1000 1000 400 400 standard max. min. ns ns ns unit symbol parameter tai in input cycle time tai out input setup time tai in input setup time t c(ta) t su(ta in -ta out ) t su(ta out -ta in ) 800 200 200
18. electrical characteristics (m16c/26t) page 289 9 2 3 f o 7 0 0 2 , 5 1 . b e f 0 0 . 2 . v e r 0 0 2 0 - 2 0 2 0 b 9 0 j e r ) t 6 2 / c 6 1 m , b 6 2 / c 6 1 m , a 6 2 / c 6 1 m ( p u o r g a 6 2 / c 6 1 m timing requirements (v cc = 5v, v ss = 0v, at topr = 40 to 85 o c unless otherwise specified) table 18.53. timer b input (counter input in event counter mode) table 18.54. timer b input (pulse period measurement mode) table 18.55. timer b input (pulse width measurement mode) table 18.56. a/d trigger input table 18.57. serial i/o _______ table 18.58. external interrupt inti input v cc = 5v ns ns ns ns ns ns ns standard max. min. tbi in input cycle time (counted on one edge) tbi in input high pulse width (counted on one edge) tbi in input low pulse width (counted on one edge) ns ns ns t c(tb) t w(tbh) t w(tbl) parameter symbol unit t c(tb) t w(tbl) t w(tbh) ns ns ns tbi in input high pulse width (counted on both edges) tbi in input low pulse width (counted on both edges) tbi in input cycle time (counted on both edges) standard max. min. ns ns t c(tb) t w(tbh) symbol parameter unit t w(tbl) ns tbi in input high pulse width tbi in input cycle time tbi in input low pulse width standard max. min. ns ns t c(tb) symbol parameter unit t w(tbl) ns t w(tbh) tbi in input cycle time tbi in input high pulse width tbi in input low pulse width standard max. min. ns ns t c(ad) t w(adl) symbol parameter unit ad trg input cycle time (trigger able minimum) ad trg input low pulse width standard max. min. ns ns t w(inh) t w(inl) symbol parameter unit inti input low pulse width inti input high pulse width standard max. min. clki input cycle time clki input high pulse width clki input low pulse width t c(ck) t w(ckh) t w(ckl) parameter symbol unit t d(c-q) t su(d-c) t h(c-q) txdi hold time rxdi input setup time txdi output delay time t h(c-d) rxdi input hold time 100 40 40 80 80 200 400 200 200 400 200 200 1000 125 250 250 200 100 100 0 70 90 80
18. electrical characteristics (m16c/26t) page 290 9 2 3 f o 7 0 0 2 , 5 1 . b e f 0 0 . 2 . v e r 0 0 2 0 - 2 0 2 0 b 9 0 j e r ) t 6 2 / c 6 1 m , b 6 2 / c 6 1 m , a 6 2 / c 6 1 m ( p u o r g a 6 2 / c 6 1 m v cc = 5v taiin input taiout input during event counter mode tbiin input adtrg input t c(ta) t w(tah) t w(tal) t c(up) t w(uph) t w(upl) t c(tb) t w(tbh) t w(tbl) t c(ad) t w(adl) t h(tin-up) t su(up-tin) taiin input (when count on falling edge is selected) taiin input (when count on rising edge is selected) taiout input (up/down input) taiin input two-phase pulse input in event counter mode t c(ta) t su(tain-taout) t su(taout-tain) t su(tain-taout) t su(taout-tain) taiout input xin input t w(h) t w(l) t r t f t c figure 18.5. timing diagram (1)
18. electrical characteristics (m16c/26t) page 291 9 2 3 f o 7 0 0 2 , 5 1 . b e f 0 0 . 2 . v e r 0 0 2 0 - 2 0 2 0 b 9 0 j e r ) t 6 2 / c 6 1 m , b 6 2 / c 6 1 m , a 6 2 / c 6 1 m ( p u o r g a 6 2 / c 6 1 m v cc = 5v figure 18.6. timing diagram (2) t su(d C c) clki txdi rxdi t c(ck) t w(ckh) t w(ckl) t w(inl) t w(inh) t d(c C q) t h(c C d) t h(c C q) inti input
18. electrical characteristics (m16c/26t) page 292 9 2 3 f o 7 0 0 2 , 5 1 . b e f 0 0 . 2 . v e r 0 0 2 0 - 2 0 2 0 b 9 0 j e r ) t 6 2 / c 6 1 m , b 6 2 / c 6 1 m , a 6 2 / c 6 1 m ( p u o r g a 6 2 / c 6 1 m v cc = 3v table 18.59. electrical characteristics ( 1) l o b m y sr e t e m a r a pn o i t i d n o c d r a d n a t s t i n u . n i m. p y t. x a m v h o h g i h t u p t u o e g a t l o v ) " h " ( 1 p 5 1 p o t 7 6 p , 0 6 p o t 7 7 p , 0 7 p o t 7 , 8 p 0 8 p o t 7 9 p , 0 9 p o t 3 0 1 p , 0 0 1 p o t 7 i h o a m 1 - = v c c - 5 . 0 v c c v v h o e g a t l o v ) " h " ( h g i h t u p t u ox t u o r e w o p h g i h i h o a m 1 . 0 - = v c c - 5 . 0 v c c v r e w o p w o l i h o 0 5 - = ? ? ? 5 8 o t 0 4 - = r p o t t a v 0 =
18. electrical characteristics (m16c/26t) page 293 9 2 3 f o 7 0 0 2 , 5 1 . b e f 0 0 . 2 . v e r 0 0 2 0 - 2 0 2 0 b 9 0 j e r ) t 6 2 / c 6 1 m , b 6 2 / c 6 1 m , a 6 2 / c 6 1 m ( p u o r g a 6 2 / c 6 1 m table 18.60. electrical characteristics (2) ( 1) v cc = 3v l o b m y sr e t e m a r a pn o i t i d n o c t n e m e r u s a e m d r a d n a t s t i n u . n i m. p y t. x a m i c c y l p p u s r e w o p t n e r r u c v ( c c ) v 6 . 3 o t 0 . 3 = e r a s n i p t u p t u o d n a n e p o t f e l e r a s n i p r e h t o v o t d e t c e n n o c s s y r o m e m h s a l f( fk l c b, z h m 0 1 = ) n o i s i v i d o n , k c o l c n i a m 72 1a m , s e t a r e p o r o t a l l i c s o p i h c - n o f ) c o r ( 2 z h m 1 = ) k l c b ( f , d e t c e l e s 1a m y r o m e m h s a l f m a r g o r p v 0 . 3 = c c v , z h m 0 1 = ) k l c b ( f 0 1a m y r o m e m h s a l f e s a r e v 0 . 3 = c c v , z h m 0 1 = ) k l c b ( f 1 1a m y r o m e m h s a l fz h k 2 3 = ) k l c b ( f, e d o m n o i t p m u s n o c r e w o p - w o l n i, m a r n o g n i n n u r m a r g o r p ) 3 ( 5 2 7 . 03 5 8 o t 0 4 - = r p o t t a v 0 = f g n i s u , s e t a r e p o r e m i t e n o h t i w . 2 2 3 c . . s t s i x e d e t u c e x e e b o t m a r g o r p e h t h c i h w n i y r o m e m e h t s e t a c i d n i s i h t . 3
18. electrical characteristics (m16c/26t) page 294 9 2 3 f o 7 0 0 2 , 5 1 . b e f 0 0 . 2 . v e r 0 0 2 0 - 2 0 2 0 b 9 0 j e r ) t 6 2 / c 6 1 m , b 6 2 / c 6 1 m , a 6 2 / c 6 1 m ( p u o r g a 6 2 / c 6 1 m timing requirements (v cc = 3v, v ss = 0v, at topr = 40 to 85 o c unless otherwise specified) table 18.61. external clock input (x in input) max. external clock rise time ns t r min. external clock input cycle time external clock input high pulse width external clock input low pulse width external clock fall time ns ns ns ns t c t w(h ) t w(l) t f parameter symbol unit standard 100 40 40 18 18 v cc = 3v
18. electrical characteristics (m16c/26t) page 295 9 2 3 f o 7 0 0 2 , 5 1 . b e f 0 0 . 2 . v e r 0 0 2 0 - 2 0 2 0 b 9 0 j e r ) t 6 2 / c 6 1 m , b 6 2 / c 6 1 m , a 6 2 / c 6 1 m ( p u o r g a 6 2 / c 6 1 m v cc = 3v timing requirements (v cc = 3v, v ss = 0v, at topr = 40 to 85 o c unless otherwise specified) table 18.62. timer a input (counter input in event counter mode) table 18.63. timer a input (gating input in timer mode) table 18.64. timer a input (external trigger input in one-shot timer mode) table 18.65. timer a input (external trigger input in pulse width modulation mode) table 18.66. timer a input (counter increment/decrement input in event counter mode) table 18.67. timer a input (two-phase pulse input in event counter mode) standard max. ns tai in input low pulse width t w(tal) min. ns ns unit tai in input high pulse width t w(tah) parameter symbol t c(ta) tai in input cycle time 60 150 60 standard max. min. ns ns ns unit tai in input cycle time tai in input high pulse width tai in input low pulse width t c(ta) t w(tah) t w(tal) symbol parameter 600 300 300 standard max. min. ns ns ns unit tai in input cycle time tai in input high pulse width tai in input low pulse width t c(ta) t w(tah) t w(tal) symbol parameter 300 150 150 standard max. min. ns ns unit t w(tah) t w(tal) symbol parameter tai in input high pulse width tai in input low pulse width 150 150 standard max. min. ns ns ns unit ns ns symbol parameter tai out input cycle time tai out input high pulse width tai out input low pulse width tai out input setup time tai out input hold time t c(up) t w(uph) t w(upl) t su(up-t in ) t h(t in- up) 3000 1500 1500 600 600 standard max. min. s ns ns unit symbol parameter tai in input cycle time tai out input setup time tai in input setup time t c(ta) t su(ta in -ta out ) t su(ta out -ta in ) 2 500 500
18. electrical characteristics (m16c/26t) page 296 9 2 3 f o 7 0 0 2 , 5 1 . b e f 0 0 . 2 . v e r 0 0 2 0 - 2 0 2 0 b 9 0 j e r ) t 6 2 / c 6 1 m , b 6 2 / c 6 1 m , a 6 2 / c 6 1 m ( p u o r g a 6 2 / c 6 1 m v cc = 3v table 18.68. timer b input (counter input in event counter mode) table 18.69. timer b input (pulse period measurement mode) table 18.70. timer b input (pulse width measurement mode) table 18.71. a/d trigger input table 18.72. serial i/o _______ table 18.73. external interrupt inti input timing requirements (v cc = 3v, v ss = 0v, at topr = 40 to 85 o c unless otherwise specified) ns ns ns ns ns ns ns standard max. min. tbi in input cycle time (counted on one edge) tbi in input high pulse width (counted on one edge) tbi in input low pulse width (counted on one edge) ns ns ns t c(tb) t w(tbh) t w(tbl) parameter symbol unit t c(tb) t w(tbl) t w(tbh) ns ns ns tbi in input high pulse width (counted on both edges) tbi in input low pulse width (counted on both edges) tbi in input cycle time (counted on both edges) standard max. min. ns ns t c(tb) t w(tbh) symbol parameter unit t w(tbl) ns tbi in input high pulse width tbi in input cycle time tbi in input low pulse width standard max. min. ns ns t c(tb) symbol parameter unit t w(tbl) ns t w(tbh) tbi in input cycle time tbi in input high pulse width tbi in input low pulse width standard max. min. ns ns t c(ad) t w(adl) symbol parameter unit ad trg input cycle time (trigger able minimum) ad trg input low pulse width standard max. min. ns ns t w(inh) t w(inl) symbol parameter unit inti input low pulse width inti input high pulse width standard max. min. clki input cycle time clki input high pulse width clki input low pulse width t c(ck) t w(ckh) t w(ckl) parameter symbol unit t d(c-q) t su(d-c) t h(c-q) txdi hold time rxdi input setup time txdi output delay time t h(c-d) rxdi input hold time 150 60 60 120 120 300 600 300 300 600 300 300 1500 200 380 380 300 150 150 0 100 90 160
18. electrical characteristics (m16c/26t) page 297 9 2 3 f o 7 0 0 2 , 5 1 . b e f 0 0 . 2 . v e r 0 0 2 0 - 2 0 2 0 b 9 0 j e r ) t 6 2 / c 6 1 m , b 6 2 / c 6 1 m , a 6 2 / c 6 1 m ( p u o r g a 6 2 / c 6 1 m v cc = 3v figure 18.7. timing diagram (1) taiin input taiout input during event counter mode tbiin input adtrg input t c(ta) t w(tah) t w(tal) t c(up) t w(uph) t w(upl) t c(tb) t w(tbh) t w(tbl) t c(ad) t w(adl) t h(tin-up) t su(up-tin) taiin input (when count on falling edge is selected) taiin input (when count on rising edge is selected) taiout input (up/down input) taiin input two-phase pulse input in event counter mode t c(ta) t su(tain-taout) t su(taout-tain) t su(tain-taout) t su(taout-tain) taiout input xin input t w(h) t w(l) t r t f t c
18. electrical characteristics (m16c/26t) page 298 9 2 3 f o 7 0 0 2 , 5 1 . b e f 0 0 . 2 . v e r 0 0 2 0 - 2 0 2 0 b 9 0 j e r ) t 6 2 / c 6 1 m , b 6 2 / c 6 1 m , a 6 2 / c 6 1 m ( p u o r g a 6 2 / c 6 1 m v cc = 3v figure 18.8. timing diagram (2) t su(d C c) clki txdi rxdi t c(ck) t w(ckh) t w(ckl) t w(inl) t w(inh) t d(c C q) t h(c C d) t h(c C q) inti input
page 299 19. usage notes 9 2 3 f o 7 0 0 2 , 5 1 . b e f 0 0 . 2 . v e r 0 0 2 0 - 2 0 2 0 b 9 0 j e r ) t 6 2 / c 6 1 m , b 6 2 / c 6 1 m , a 6 2 / c 6 1 m ( p u o r g a 6 2 / c 6 1 m 19. usage notes 19.1 sfr 19.1.1 precaution for 48-pin package set the ifsr20 bit in the ifsr2a register to "1" after reset and set the pacr2 to pacr0 bits in the pacr register to "100 2 ". 19.1.2 precaution for 42-pin package set the ifsr20 bit in the ifsr2a register to "1" after reset and set the pacr2 to pacr0 bits in the pacr register to "001 2 ". 19.1.3 register setting immediate values should be set in the registers containing write-only bits. when establishing a new value by modifying a previous value, write the previous value into ram as well as the register. change the contents of the ram and then transfer the new value to the register.
page 300 19. usage notes 9 2 3 f o 7 0 0 2 , 5 1 . b e f 0 0 . 2 . v e r 0 0 2 0 - 2 0 2 0 b 9 0 j e r ) t 6 2 / c 6 1 m , b 6 2 / c 6 1 m , a 6 2 / c 6 1 m ( p u o r g a 6 2 / c 6 1 m 19.2 pll frequency synthesizer stabilize supply voltage so that the standard of the power supply ripple is met. 10 typ. max. unit parameter f (ripple) power supply ripple allowable frequency(v cc ) symbol min. standard khz power supply ripple allowabled amplitude voltage power supply ripple rising/falling gradient (v cc =5v) (v cc =3v) (v cc =5v) (v cc =3v) v p-p(ripple) v cc(| ? ? figure 19.1 timing of voltage fluctuation
page 301 19. usage notes 9 2 3 f o 7 0 0 2 , 5 1 . b e f 0 0 . 2 . v e r 0 0 2 0 - 2 0 2 0 b 9 0 j e r ) t 6 2 / c 6 1 m , b 6 2 / c 6 1 m , a 6 2 / c 6 1 m ( p u o r g a 6 2 / c 6 1 m 19.3 power control 1. when exiting stop mode by hardware reset, the device will startup using the on-chip oscillator. 2. set the mr0 bit in the taimr register(i=0 to 4) to 0 (pulse is not output) to use the timer a to exit stop mode. 3. when entering wait mode, insert a jmp.b instruction before a wait instruction. do not excute any instructions which can generate a write to ram between the jmp.b and wait instructions. disable the dma transfers, if a dma transfer may occur between the jmp.b and wait instructions. after the wait instruction, insert at least 4 nop instructions. when entering wait mode, the instruction queue reads ahead the instructions following wait, and depending on timing, some of these may execute before the microcomputer enters wait mode. program example when entering wait mode program example: jmp.b l1 ; insert jmp.b instruction before wait instruction l1: fset i ; wait ; enter wait mode nop ; more than 4 nop instructions nop nop nop 4. when entering stop mode, insert a jmp.b instruction immediately after executing an instruction which sets the cm10 bit in the cm1 register to 1 , and then insert at least 4 nop instructions. when entering stop mode, the instruction queue reads ahead the instructions following the instruction which sets the cm10 bit to 1 (all clock stops), and, some of these may execute before the microcomputer enters stop mode or before the interrupt routine for returning from stop mode. program example when entering stop mode program example: fset i bset cm10 ; enter stop mode jmp.b l1 ; insert jmp.b instruction l1: nop ; more than 4 nop instructions nop nop nop
page 302 19. usage notes 9 2 3 f o 7 0 0 2 , 5 1 . b e f 0 0 . 2 . v e r 0 0 2 0 - 2 0 2 0 b 9 0 j e r ) t 6 2 / c 6 1 m , b 6 2 / c 6 1 m , a 6 2 / c 6 1 m ( p u o r g a 6 2 / c 6 1 m 5. wait until the main clock oscillation stabilization time, before switching the cpu clock source to the main clock. similarly, wait until the sub clock oscillates stably before switching the cpu clock source to the sub clock. 6. suggestions to reduce power consumption (a) ports the processor retains the state of each i/o port even when it goes to wait mode or to stop mode. a current flows in active i/o ports. a dash current may flow through the input ports in high impedance state, if the input is floating. when entering wait mode or stop mode, set non-used ports to input and stabilize the potential. (b) a/d converter when a/d conversion is not performed, set the vcut bit in the adcon1 register to 0 (no v ref connection). when a/d conversion is performed, start the a/d conversion at least 1 1 (v ref connection). (c) stopping peripheral functions use the cm02 bit in the cm0 register to stop the unnecessary peripheral functions during wait mode. however, because the peripheral function clock (f c32 ) generated from the sub-clock does not stop, this measure is not conducive to reducing the power consumption of the chip. if low speed mode or low power dissipation mode is to be changed to wait mode, set the cm02 bit to 0 (do not stop peripheral function clocks in wait mode), before changing wait mode. (d) switching the oscillation-driving capacity set the driving capacity to low when oscillation is stable.
page 303 19. usage notes 9 2 3 f o 7 0 0 2 , 5 1 . b e f 0 0 . 2 . v e r 0 0 2 0 - 2 0 2 0 b 9 0 j e r ) t 6 2 / c 6 1 m , b 6 2 / c 6 1 m , a 6 2 / c 6 1 m ( p u o r g a 6 2 / c 6 1 m 19.4 protect set the prc2 bit to 1 (write enabled) and then write to any address, and the prc2 bit will be cleared to 0 (write protected). the registers protected by the prc2 bit should be changed in the next instruction after setting the prc2 bit to 1 . make sure no interrupts or dma transfers will occur between the instruction in which the prc2 bit is set to 1 and the next instruction.
page 304 19. usage notes 9 2 3 f o 7 0 0 2 , 5 1 . b e f 0 0 . 2 . v e r 0 0 2 0 - 2 0 2 0 b 9 0 j e r ) t 6 2 / c 6 1 m , b 6 2 / c 6 1 m , a 6 2 / c 6 1 m ( p u o r g a 6 2 / c 6 1 m 19.5 interrupts 19.5.1 reading address 00000 16 do not read the address 00000 16 in a program. when a maskable interrupt request is accepted, the cpu reads interrupt information (interrupt number and interrupt request priority level) from the address 00000 16 during the interrupt sequence. at this time, the ir bit for the accepted interrupt is cleared to 0 . if the address 00000 16 is read in a program, the ir bit for the interrupt which has the highest priority among the enabled interrupts is cleared to 0 . this causes a problem that the interrupt is canceled, or an unexpected interrupt request is generated. 19.5.2 setting the sp set any value in the sp(usp, isp) before accepting an interrupt. the sp(usp, isp) is cleared to 0000 16 after reset. therefore, if an interrupt is accepted before setting any value in the sp(usp, isp), the pro- gram may go out of control. _______ 19.5.3 the nmi interrupt _______ _______ 1. the nmi interrupt is invalid after reset. the nmi interrupt becomes effective by setting to 1 the pm24 _______ bit in the pm2 register. set the pm24 bit to "1" when a high-level signal ("h") is applied to the nmi pin. _______ _______ if the pm24 bit is set to "1" when a low-level signal ("l") is applied, nmi interrupt is generated. once nmi interrupt is enabled, it will not be disabled unless a reset is applied. _______ 2. the input level of the nmi pin can be read by accessing the p8_5 bit in the p8 register. _______ _______ 3. when selecting nmi function, stop mode cannot be entered into while input on the nmi pin is low. this _______ is because while input on the nmi pin is low the cm10 bit in the cm1 register is fixed to 0 . _______ _______ 4. when selecting nmi function, do not go to wait mode while input on the nmi pin is low. this is because _______ when input on the nmi pin goes low, the cpu stops but cpu clock remains active; therefore, the current consumption in the chip does not drop. in this case, normal condition is restored by an interrupt gener- ated thereafter. _______ _______ 5. when selecting nmi function, the low and high level durations of the input signal to the nmi pin must each be 2 cpu clock cycles + 300 ns or more. _______ 6. when using the nmi interrupt for exiting stop mode, set the nddr register to ff 16 (disable digital debounce filter) before entering stop mode. 19.5.4 changing the interrupt generation factor if the interrupt generate factor is changed, the ir bit in the interrupt control register for the changed interrupt may inadvertently be set to 1 (interrupt requested). if you changed the interrupt generate factor for an interrupt that needs to be used, be sure to clear the ir bit for that interrupt to 0 (interrupt not requested). changing the interrupt generate factor referred to here means any act of changing the source, polarity or timing of the interrupt assigned to each software interrupt number. therefore, if a mode change of any peripheral function involves changing the generate factor, polarity or timing of an interrupt, be sure to clear the ir bit for that interrupt to 0 (interrupt not requested) after making such changes. refer to the description of each peripheral function for details about the interrupts from peripheral functions. figure 19.2 shows the procedure for changing the interrupt generate factor.
page 305 19. usage notes 9 2 3 f o 7 0 0 2 , 5 1 . b e f 0 0 . 2 . v e r 0 0 2 0 - 2 0 2 0 b 9 0 j e r ) t 6 2 / c 6 1 m , b 6 2 / c 6 1 m , a 6 2 / c 6 1 m ( p u o r g a 6 2 / c 6 1 m ______ 19.5.5 int interrupt 1. either an l level of at least t w ( inh ) or an h level of at least t w ( inl ) width is necessary for the signal _______ _______ input to pins int 0 through int 5 regardless of the cpu operation clock. 2. if the pol bit in the int0ic to int5ic registers or the ifsr7 to ifsr0 bits in the ifsr register are changed, the ir bit may inadvertently set to 1 (interrupt requested). be sure to clear the ir bit to 0 (interrupt not requested) after changing any of those register bits. 3. when using the int 5 interrupt for exiting stop mode, set the p17ddr register to ff 16 (disable digital debounce filter) before entering stop mode. figure 19.2. procedure for changing the interrupt generate factor changing the interrupt source disable interrupts (2, 3) use the mov instruction to clear the ir bit to 0 (interrupt not requested) (3) change the interrupt generate factor (including a mode change of peripheral function) enable interrupts (2, 3) end of change ir bit: a bit in the interrupt control register for the interrupt whose interrupt generate factor is to be changed notes: 1. the above settings must be executed individually. do not execute two or more settings simultaneously (using one instruction). 2. use the i flag for the inti interrupt (i = 0 to 5). for the interrupts from peripheral functions other than the inti interrupt, turn off the peripheral function that is the source of the interrupt in order not to generate an interrupt request before changing the interrupt generate factor. in this case, if the maskable interrupts can all be disabled without causing a problem, use the i flag. otherwise, use the corresponding 3. refer to 19.5.6 rewrite the interrupt control register for details about the instructions to use and the notes to be taken for instruction execution.
page 306 19. usage notes 9 2 3 f o 7 0 0 2 , 5 1 . b e f 0 0 . 2 . v e r 0 0 2 0 - 2 0 2 0 b 9 0 j e r ) t 6 2 / c 6 1 m , b 6 2 / c 6 1 m , a 6 2 / c 6 1 m ( p u o r g a 6 2 / c 6 1 m 19.5.6 rewrite the interrupt control register (1) the interrupt control register for any interrupt should be modified in places where no requests for that interrupt may occur. otherwise, disable the interrupt before rewriting the interrupt control register. (2) to rewrite the interrupt control register for any interrupt after disabling that interrupt, be careful with the instruction to be used. changing any bit other than the ir bit if while executing an instruction, a request for an interrupt controlled by the register being modified occurs, the ir bit in the register may not be set to 1 (interrupt requested), with the result that the interrupt request is ignored. if such a situation presents a problem, use the instructions shown below to modify the register. usable instructions: and, or, bclr, bset changing the ir bit depending on the instruction used, the ir bit may not always be cleared to 0 (interrupt not re- quested). therefore, be sure to use the mov instruction to clear the ir bit. (3) when using the i flag to disable an interrupt, refer to the sample program fragments shown below as you set the i flag. (refer to (2) for details about rewrite the interrupt control registers in the sample program fragments.) examples 1 through 3 show how to prevent the i flag from being set to 1 (interrupts enabled) before the interrupt control register is rewritten, due to the internal bus and the instruction queue buffer timing. example 1: using the nop instruction to keep the program waiting until the interrupt control register is modified int_switch1: fclr i ; disable interrupts and.b #00h, 0055h ;set the ta0ic register to 00 16 nop ; nop fset i ; enable interrupts the number of nop instruction is as follows. pm20 = 1 (1 wait) : 2, pm20 = 0 (2 waits): 3 example 2:using the dummy read to keep the fset instruction waiting int_switch2: fclr i ; disable interrupts and.b #00h, 0055h ; set the ta0ic register to 00 16 mov.w mem, r0 ; dummy read fset i ; enable interrupts example 3:using the popc instruction to changing the i flag int_switch3: pushc flg fclr i ; disable interrupts and.b #00h, 0055h ; set the ta0ic register to 00 16 popc flg ; enable interrupts 19.5.7 watchdog timer interrupt initialize the watchdog timer after the watchdog timer interrupt occurs.
page 307 19. usage notes 9 2 3 f o 7 0 0 2 , 5 1 . b e f 0 0 . 2 . v e r 0 0 2 0 - 2 0 2 0 b 9 0 j e r ) t 6 2 / c 6 1 m , b 6 2 / c 6 1 m , a 6 2 / c 6 1 m ( p u o r g a 6 2 / c 6 1 m 19.6 dmac 19.6.1 write to dmae bit in dmicon register when both of the conditions below are met, follow the steps below. conditions ? the dmae bit is set to 1 again while it remains set (dmai is in an active state). ? a dma request may occur simultaneously when the dmae bit is being written. step 1: write 1 to the dmae bit and dmas bit in dmicon register simultaneously (*1) . step 2: make sure that the dmai is in an initial state (*2) in a program. if the dmai is not in an initial state, the above steps should be repeated. notes: 1. the dmas bit remains unchanged even if 1 is written. however, if 0 is written to this bit, it is set to 0 (dma not requested). in order to prevent the dmas bit from being modified to 0 , 1 should be written to the dmas bit when 1 is written to the dmae bit. in this way the state of the dmas bit immediately before being written can be maintained. similarly, when writing to the dmae bit with a read-modify-write instruction, 1 should be written to the dmas bit in order to maintain a dma request which is generated during execution. 2. read the tcri register to verify whether the dmai is in an initial state. if the read value is equal to a value which was written to the tcri register before dma transfer start, the dmai is in an initial state. (if a dma request occurs after writing to the dmae bit, the value written to the tcri register is 1 .) if the read value is a value in the middle of transfer, the dmai is not in an initial state.
page 308 19. usage notes 9 2 3 f o 7 0 0 2 , 5 1 . b e f 0 0 . 2 . v e r 0 0 2 0 - 2 0 2 0 b 9 0 j e r ) t 6 2 / c 6 1 m , b 6 2 / c 6 1 m , a 6 2 / c 6 1 m ( p u o r g a 6 2 / c 6 1 m 19.7 timer 19.7.1 timer a 19.7.1.1 timer a (timer mode) 1. the timer remains idle after reset. set the mode, count source, counter value, etc. using the taimr (i = 0 to 4) register and the tai register before setting the tais bit in the tabsr register to 1 (count starts). always make sure the taimr register is modified while the tais bit remains 0 (count stops) regardless whether after reset or not. 2. while counting is in progress, the counter value can be read out at any time by reading the tai register. however, if the tai register is read at the same time the counter is reloaded, the read value is always ffff 16 . if the tai register is read after setting a value in it, but before the counter starts counting, the read value is the one that has been set in the register. _____ 3. if a low-level signal is applied to the sd pin when the ivpcr1 bit in the tb2sc register is set to 1 _____ (three-phase output forcible cutoff by input on sd pin enabled), the ta1 out , ta2 out and ta4 out pins go to a high-impedance state. 19.7.1.2 timer a (event counter mode) 1. the timer remains idle after reset. set the mode, count source, counter value, etc. using the taimr (i = 0 to 4) register, the tai register, the udf register, the tazie, ta0tgl and ta0tgh bits in the onsf register and the trgsr register before setting the tais bit in the tabsr register to 1 (count starts). always make sure the taimr register, the udf register, the tazie, ta0tgl and ta0tgh bits and the trgsr register are modified while the tais bit remains 0 (count stops) regardless whether after reset or not. 2. while counting is in progress, the counter value can be read out at any time by reading the tai register. however, if the tai register is read at the same time the counter is reloaded, the read value is always ffff 16 when the timer counter underflows and 0000 16 when the timer counter over- flows. if the tai register is read after setting a value in it, but before the counter starts counting, the read value is the one that has been set in the register. _____ 3. if a low-level signal is applied to the sd pin when the ivpcr1 bit in the tb2sc register is set to 1 _____ (three-phase output forcible cutoff by input on sd pin enabled), the ta1 out , ta2 out and ta4 out pins go to a high-impedance state.
page 309 19. usage notes 9 2 3 f o 7 0 0 2 , 5 1 . b e f 0 0 . 2 . v e r 0 0 2 0 - 2 0 2 0 b 9 0 j e r ) t 6 2 / c 6 1 m , b 6 2 / c 6 1 m , a 6 2 / c 6 1 m ( p u o r g a 6 2 / c 6 1 m 19.7.1.3 timer a (one-shot timer mode) 1. the timer remains idle after reset. set the mode, count source, counter value, etc. using the taimr (i = 0 to 4) register, the tai register, the ta0tgl and ta0tgh bits in the onsf register and the trgsr register before setting the tais bit in the tabsr register to 1 (count starts). always make sure the taimr register, the ta0tgl and ta0tgh bits and the trgsr register are modified while the tais bit remains 0 (count stops) regardless whether after reset or not. 2. when setting tais bit to 0 (count stop), the following occur: ? the counter stops counting and the content of reload register is reloaded. ? tai out pin outputs l . ? after one cycle of the cpu clock, the ir bit in the taiic register is set to 1 (interrupt request). 3. output in one-shot timer mode synchronizes with a count source internally generated. when the external trigger has been selected, a maximun delay of one cycle of the count source occurs be- tween the trigger input to tai in pin and output in one-shot timer mode. 4. the ir bit is set to 1 when timer operation mode is set with any of the following procedures: ? select one-shot timer mode after reset. ? change the operation mode from timer mode to one-shot timer mode. ? change the operation mode from event counter mode to one-shot timer mode. to use the timer ai interrupt (the ir bit), set the ir bit to 0 after the changes listed above have been made. 5. when a trigger occurs while the timer is counting, the counter reloads the reload register value, and continues counting after a second trigger is generated and the counter is decremented once. to generate a trigger while counting, space more than one cycle of the timer count source from the first trigger and generate again. 6. when selecting the external trigger for the count start conditions in timer a one-shot timer mode, do generate an external trigger 300ns before the count value of timer a is set to 0000 16 . the one-shot timer does not continue counting and may stop. _____ 7. if a low-level signal is applied to the sd pin when the ivpcr1 bit in the tb2sc register is set to 1 _____ (three-phase output forcible cutoff by input on sd pin enabled), the ta1 out , ta2 out and ta4 out pins go to a high-impedance state.
page 310 19. usage notes 9 2 3 f o 7 0 0 2 , 5 1 . b e f 0 0 . 2 . v e r 0 0 2 0 - 2 0 2 0 b 9 0 j e r ) t 6 2 / c 6 1 m , b 6 2 / c 6 1 m , a 6 2 / c 6 1 m ( p u o r g a 6 2 / c 6 1 m 19.7.1.4 timer a (pulse width modulation mode) 1. the timer remains idle after reset. set the mode, count source, counter value, etc. using the taimr (i = 0 to 4) register, the tai register, the ta0tgl and ta0tgh bits in the onsf register and the trgsr register before setting the tais bit in the tabsr register to 1 (count starts). always make sure the taimr register, the ta0tgl and ta0tgh bits and the trgsr register are modified while the tais bit remains 0 (count stops) regardless whether after reset or not. 2. the ir bit is set to 1 when setting a timer operation mode with any of the following procedures: ? select the pwm mode after reset. ? change an operation mode from timer mode to pwm mode. ? change an operation mode from event counter mode to pwm mode. to use the timer ai interrupt (interrupt request bit), set the ir bit to 0 by program after the above listed changes have been made. 3. when setting tais register to 0 (count stop) during pwm pulse output, the following action occurs: ? stop counting. ? when tai out pin is output h , output level is set to l and the ir bit is set to 1 . ? when tai out pin is output l , both output level and the ir bit remains unchanged. _____ 4. if a low-level signal is applied to the sd pin when the ivpcr1 bit in the tb2sc register is set to 1 _____ (three-phase output forcible cutoff by input on sd pin enabled), the ta1 out , ta2 out and ta4 out pins go to a high-impedance state.
page 311 19. usage notes 9 2 3 f o 7 0 0 2 , 5 1 . b e f 0 0 . 2 . v e r 0 0 2 0 - 2 0 2 0 b 9 0 j e r ) t 6 2 / c 6 1 m , b 6 2 / c 6 1 m , a 6 2 / c 6 1 m ( p u o r g a 6 2 / c 6 1 m 19.7.2 timer b 19.7.2.1 timer b (timer mode) 1. the timer remains idle after reset. set the mode, count source, counter value, etc. using the tbimr (i = 0 to 2) register and tbi register before setting the tbis bit in the tabsr register to 1 (count starts). always make sure the tbimr register is modified while the tbis bit remains 0 (count stops) regardless whether after reset or not. 2. the counter value can be read out at any time by reading the tbi register. however, if this register is read at the same time the counter is reloaded, the read value is always ffff 16 . if the tbi register is read after setting a value in it but before the counter starts counting, the read value is the one that has been set in the register. 19.7.2.2 timer b (event counter mode) 1. the timer remains idle after reset. set the mode, count source, counter value, etc. using the tbimr (i = 0 to 2) register and tbi register before setting the tbis bit in the tabsr register to 1 (count starts). always make sure the tbimr register is modified while the tbis bit remains 0 (count stops) regardless whether after reset or not. 2. the counter value can be read out at any time by reading the tbi register. however, if this register is read at the same time the counter is reloaded, the read value is always ffff 16 . if the tbi register is read after setting a value in it but before the counter starts counting, the read value is the one that has been set in the register.
page 312 19. usage notes 9 2 3 f o 7 0 0 2 , 5 1 . b e f 0 0 . 2 . v e r 0 0 2 0 - 2 0 2 0 b 9 0 j e r ) t 6 2 / c 6 1 m , b 6 2 / c 6 1 m , a 6 2 / c 6 1 m ( p u o r g a 6 2 / c 6 1 m 19.7.2.3 timer b (pulse period/pulse width measurement mode) 1. the timer remains idle after reset. set the mode, count source, etc. using the tbimr (i = 0 to 2) register before setting the tbis bit in the tabsr register to 1 (count starts). always make sure the tbimr register is modified while the tbis bit remains 0 (count stops) regardless whether after reset or not. to clear the mr3 bit to 0 by writing to the tbimr register while the tbis bit is set to 1 (count starts), be sure to set the tm0d0, tm0d1, mr0, mr1, tck0 and tck1 bits to the same value as previously written and the mr2 bit to "0". 2. the ir bit in the tbiic register (i=0 to 2) goes to 1 (interrupt request), when an effective edge of a measurement pulse is input or timer bi is overflowed. the factor of interrupt request can be determined by use of the mr3 bit in the tbimr register within the interrupt routine. 3. if the source of interrupt cannot be identified by the mr3 bit such as when the measurement pulse input and a timer overflow occur at the same time, use another timer to count the number of times timer b has overflowed. 4. to set the mr3 bit to 0 (no overflow), set tbimr register with setting the tbis bit to 1 and counting the next count source after setting the mr3 bit to 1 (overflow). 5. use the ir bit in the tbiic register to detect only overflows. use the mr3 bit only to determine the interrupt factor within the interrupt routine. 6. when the count is started and the first effective edge is input, an indeterminate value is transferred to the reload register. at this time, timer bi interrupt request is not generated. 7. the value of the counter is indeterminate at the beginning of a count. mr3 may be set to 1 and timer bi interrupt request may be generated between the count start and an effective edge input. 8. for pulse width measurement, pulse widths are successively measured. use program to check whether the measurement result is an h level width or an l level width. 19.7.3 three-phase motor control timer function when the ivpcr1 bit in the tb2sc register is set to 1 (three-phase output forced cutoff by sd pin input (high-impedance) enabled), the inv03 bit in the invc0 register is set to 1 (three-phase motor control _____ timer output enabled), and a low-level ("l") signal is applied to the sd pin while a three-phase pwm ___ ___ ___ signal is output, the mcu is forced to cutoff and pins u, u, v, v, w, and w are placed in a high-impedance state and the inv03 bit is set to 0 (three-phase motor control timer output disabled). ___ ___ ___ to resume the three-phase pwm signal output from pins u, u, v, v, w, and w, set the inv03 bit to 1 and _____ the ivpcr1 bit to 0 (three-phase output forced cutoff disabled) after the sd pin level becomes "h". then set the ivpcr1 bit to 1 (three-phase output forced cutoff enabled) in order to enable the three-phase output forced cutoff function by input to the sd pin again. _____ the inv03 bit cannot be set to 1 while an "l" signal is input to the sd pin. to set the inv03 bit to 1 after forcible cutoff, write 1 to the inv03 bit and read the bit to ensure that it is set to 1 by program. then set the ivpcr1 bit to 1 after setting it to 0.
page 313 19. usage notes 9 2 3 f o 7 0 0 2 , 5 1 . b e f 0 0 . 2 . v e r 0 0 2 0 - 2 0 2 0 b 9 0 j e r ) t 6 2 / c 6 1 m , b 6 2 / c 6 1 m , a 6 2 / c 6 1 m ( p u o r g a 6 2 / c 6 1 m 19.8 serial i/o 19.8.1 clock-synchronous serial i/o 19.8.1.1 transmission/reception _______ ________ 1. with an external clock selected, and choosing the rts function, the output level of the rtsi pin goes to l when the data-receivable status becomes ready, which informs the transmission side ________ that the reception has become ready. the output level of the rtsi pin goes to h when reception ________ ________ starts. so if the rtsi pin is connected to the ctsi pin on the transmission side, the circuit can _______ transmit and receive data with consistent timing. with the internal clock, the rts function has no effect. _____ 2. if a low-level signal is applied to the sd pin when the ivpcr1 bit in the tb2sc register is set to 1 _____ _________ (three-phase output forcible cutoff by input on sd pin enabled), the p7 3 /rts 2 /txd1(when the u1map bit in pacr register is 1 ) and clk 2 pins go to a high-impedance state. 19.8.1.2 transmission when an external clock is selected, the conditions must be met while if the ckpol bit in the uic0 register is set to 0 (transmit data output at the falling edge and the receive data taken in at the rising edge of the transfer clock), the external clock is in the high state; if the ckpol bit in the uic0 register is set to 1 (transmit data output at the rising edge and the receive data taken in at the falling edge of the transfer clock), the external clock is in the low state. ? the te bit in the uic1 register is set to 1 (transmission enabled) ? the ti bit in the uic1 register is set to 0 (data present in uitb register) _______ _______ ? if cts function is selected, input on the ctsi pin is l 19.8.1.3 reception 1. in operating the clock-synchronous serial i/o, operating the transmitter generates a clock for the receiver shift register. fix settings for transmission even when using the device only for reception. dummy data is output to the outside from the txdi pin when receiving data. 2. when an internal clock is selected, set the te bit in the uic1 register (i = 0 to 2) to 1 (transmission enabled) and write dummy data to the uitb register, and the clock for the receiver shift register will thereby be generated. when an external clock is selected, set the te bit to "1" and write dummy data to the uitb register, and the clock for the receiver shift register will be generated when the external clock is fed to the clki input pin. 3. when successively receiving data, if all bits of the next receive data are prepared in the uarti receive register while the re bit in the uic1 register (i = 0 to 2) is set to 1 (data present in the uirb register), an overrun error occurs and the oer bit in the uirb register is set to 1 (overrun error occurred). in this case, because the content of the uirb register is indeterminate, a corrective measure must be taken by programs on the transmit and receive sides so that the valid data before the overrun error occurred will be retransmitted. note that when an overrun error occurred, the ir bit in the siric register does not change state. 4. to receive data in succession, set dummy data in the lower-order byte of the uitb register every time reception is made. 5. when an external clock is selected, make sure the external clock is in high state if the ckpol bit is set to 0 , and in low state if the ckpol bit is set to 1 before the following conditions are met: ? set the re bit in the uic1 register to 1 (reception enabled) ? set the te bit in the uic1 register to 1 (transmission enabled) ? set the ti bit in the uic1 register to 0 (data present in the uitb register)
page 314 19. usage notes 9 2 3 f o 7 0 0 2 , 5 1 . b e f 0 0 . 2 . v e r 0 0 2 0 - 2 0 2 0 b 9 0 j e r ) t 6 2 / c 6 1 m , b 6 2 / c 6 1 m , a 6 2 / c 6 1 m ( p u o r g a 6 2 / c 6 1 m 19.8.2 serial i/o (uart mode) 19.8.1.1 special mode 1 (i 2 c bus mode) when generating start, stop and restart conditions, set the stspsel bit in the u2smr4 register to 0 and wait for more than half cycle of the transfer clock before setting each condition generate bit (stareq, rstareq and stpreq) from 0 to 1 . 19.8.1.2 special mode 2 _______ _____ if a low-level signal is applied to the p8 5 /nmi/sd pin when the ivpcr1 bit in the tb2sc register is set _____ to "1" (three-phase output forcible cutoff by input on sd pin enabled), the p7 3 /rts 2 /txd1(when the u1map bit in pacr register is 1 ) and clk 2 pins go to a high-impedance state. 19.8.1.3 special mode 4 (sim mode) a transmit interrupt request is generated by setting the u2irs bit in the u2c1 register to 1 (transmis- sion complete) and u2ere bit to 1 (error signal output) after reset. therefore, when using sim mode, be sure to clear the ir bit to 0 (no interrupt request) after setting these bits.
page 315 19. usage notes 9 2 3 f o 7 0 0 2 , 5 1 . b e f 0 0 . 2 . v e r 0 0 2 0 - 2 0 2 0 b 9 0 j e r ) t 6 2 / c 6 1 m , b 6 2 / c 6 1 m , a 6 2 / c 6 1 m ( p u o r g a 6 2 / c 6 1 m 19.9 a/d converter 1. set adcon0 (except bit 6), adcon1 and adcon2 registers when a/d conversion is stopped (before a trigger occurs). 2. when the vcut bit in the adcon1 register is changed from 0 (vref not connected) to 1 (v ref connected), start a/d conversion after waiting 1 0 (input mode). also, if the tgr bit in adcon0 register is set to "1" (external trigger), make sure the port ___________ direction bit for the ad trg pin is set to 0 (input mode). 5. when using key input interrupts, do not use any of the four an 4 to an 7 pins as analog inputs. (a key input interrupt request is generated when the a/d input voltage goes low.) 6. the figure 19.3. use of capacitors to reduce noise microcomputer v cc v ss av cc av ss v ref an i c4 c1 c2 c3 an i : an i (i=0 to 7), an 24 , and an 3i (i=0 to 2) v cc v cc notes: 1. c1
page 316 19. usage notes 9 2 3 f o 7 0 0 2 , 5 1 . b e f 0 0 . 2 . v e r 0 0 2 0 - 2 0 2 0 b 9 0 j e r ) t 6 2 / c 6 1 m , b 6 2 / c 6 1 m , a 6 2 / c 6 1 m ( p u o r g a 6 2 / c 6 1 m 8. if the cpu reads the a/d register i (i = 0 to 7) at the same time the conversion result is stored in the a/ d register i after completion of a/d conversion, an incorrect value may be stored in the a/d register i. this problem occurs when a divide-by-n clock derived from the main clock or a subclock is selected for cpu clock. ? when operating in one-shot mode, single-sweep mode, simultaneous sample sweep mode, delayed trigger mode 0 or delayed trigger mode 1 check to see that a/d conversion is completed before reading the target a/d register i. (check the ir bit in the adic register to see if a/d conversion is completed.) ? when operating in repeat mode or repeat sweep mode 0 or 1 use the main clock for cpu clock directly without dividing it. 9. if a/d conversion is forcibly terminated while in progress by setting the adst bit in the adcon0 register to 0 (a/d conversion halted), the conversion result of the a/d converter is indeterminate. the contents of a/d register i irrelevant to a/d conversion may also become indeterminate. if while a/d conversion is underway the adst bit is cleared to 0 in a program, ignore the values of all a/d register i. 10.when setting the adst bit in the adcon register to "0" to terminate a conversion forcefully by the program in single sweep conversion mode, a/d delayed trigger mode 0 and a/d delayed trigger mode 1 during a/d conversion operation, the a/d interrupt request may be generated. if this causes a prob- lem, set the adst bit to "0" after the interrupt is disabled.
page 317 19. usage notes 9 2 3 f o 7 0 0 2 , 5 1 . b e f 0 0 . 2 . v e r 0 0 2 0 - 2 0 2 0 b 9 0 j e r ) t 6 2 / c 6 1 m , b 6 2 / c 6 1 m , a 6 2 / c 6 1 m ( p u o r g a 6 2 / c 6 1 m 19.10 programmable i/o ports _____ 1. if a low-level signal is applied to the sd pin when the ivpcr1 bit in the tb2sc register is set to 1 _____ (three-phase output forcible cutoff by input on sd pin enabled), the p7 2 to p7 5 , p8 0 and p8 1 pins go to a high-impedance state. 2. the input threshold voltage of pins differs between programmable input/output ports and peripheral functions. therefore, if any pin is shared by a programmable input/output port and a peripheral function and the input level at this pin is outside the range of recommended operating conditions v ih and v il (neither high nor low ), the input level may be determined differently depending on which side the program- mable input/output port or the peripheral function is currently selected. 3. when the inv03 bit in the invc0 register is "1"(three-phase motor control timer output enabled), an "l" _______ _____ input on the p8 5 /nmi/sd pin, has the following effect: ? when the ivpcr1 bit in the tb2sc register is set to 1 (three-phase output forcible cutoff by input _____ __ __ ___ on the sd pin enabled), the u/ u/ v/ v/ w/ w pins go to a high-impedance state. _____ ? when the ivpcr1 bit is set to 0 (three-phase output forcible cutoff by input on sd pin __ __ ___ disabled), the u/ u/ v/ v/ w/ w pins go to a normal port. therefore, the p8 5 pin can not be used as programmable i/o port when the inv03 bit is set to "1". _____ _______ _____ when the sd function isn't used, set pd8 5 to 0 (input) and pull the p8 5 /nmi/sd pin to h externally.
page 318 19. usage notes 9 2 3 f o 7 0 0 2 , 5 1 . b e f 0 0 . 2 . v e r 0 0 2 0 - 2 0 2 0 b 9 0 j e r ) t 6 2 / c 6 1 m , b 6 2 / c 6 1 m , a 6 2 / c 6 1 m ( p u o r g a 6 2 / c 6 1 m 19.11 electric characteristic differences between mask rom and flash memory ver- sion microcomputers flash memory version and mask rom version may have different characteristics, operating margin, noise tolerated dose, noise width dose in electrical characteristics due to internal rom, different layout pattern, etc. when switching to the mask rom version, conduct equivalent tests as system evaluation tests con- ducted in the flash memory version.
page 319 19. usage notes 9 2 3 f o 7 0 0 2 , 5 1 . b e f 0 0 . 2 . v e r 0 0 2 0 - 2 0 2 0 b 9 0 j e r ) t 6 2 / c 6 1 m , b 6 2 / c 6 1 m , a 6 2 / c 6 1 m ( p u o r g a 6 2 / c 6 1 m 19.12 mask rom version 19.12.1 internal rom area when using the masked rom version, write nothing to internal rom area. writing to the area may increase power consumption. 19.12.2 reserve bit the b3 to b0 in address 0fffff 16 are reserved bits. set these bits to 1111 2 .
page 320 19. usage notes 9 2 3 f o 7 0 0 2 , 5 1 . b e f 0 0 . 2 . v e r 0 0 2 0 - 2 0 2 0 b 9 0 j e r ) t 6 2 / c 6 1 m , b 6 2 / c 6 1 m , a 6 2 / c 6 1 m ( p u o r g a 6 2 / c 6 1 m 19.13 flash memory version 19.13.1 functions to inhibit rewriting flash memory id codes are stored in addresses 0fffdf 16 , 0fffe3 16 , 0fffeb 16 , 0fffef 16 , 0ffff3 16 , 0ffff7 16 , and 0ffffb 16 . if wrong data is written to these addresses, the flash memory cannot be read or written in standard serial i/o mode. the romcp register is mapped in address 0fffff 16 . if wrong data is written to this address, the flash memory cannot be read or written in parallel i/o mode. in the flash memory version of microcomputer, these addresses are allocated to the vector addresses (h) of fixed vectors.the b3 to b0 in address 0fffff 16 are reserved bits. set these bits to 1111 2 . 19.13.2 stop mode when the microcomputer enters stop mode, execute the instruction which sets the cm10 bit to 1 (stop mode) after setting the fmr01 bit to 0 (cpu rewrite mode disabled) and disabling the dma transfer. 19.13.3 wait mode when the microcomputer enters wait mode, excute the wait instruction after setting the fmr01 bit to 0 (cpu rewrite mode disabled). 19.13.4 low power dissipation mode, on-chip oscillator low power dissipation mode if the cm05 bit is set to 1 (main clock stop), the following commands must not be executed. ? program ? block erase 19.13.5 writing command and data write the command code and data at even addresses. 19.13.6 program command write xx40 16 in the first bus cycle and write data to the write address in the second bus cycle, and an auto program operation (data program and verify) will start. make sure the address value specified in the first bus cycle is the same even address as the write address specified in the second bus cycle. 19.13.7 operation speed when cpu clock source is main clock, before entering cpu rewrite mode (ew0 or ew1 mode), select 10 mhz or less for bclk using the cm06 bit in the cm0 register and the cm17 to cm16 bits in the cm1 register. also, when cpu clock is f 3 (roc) on-chip oscillator clock, before entering cpu rewrite mode (ew0 or ew1 mode), set the rocr3 to rocr2 bits in the rocr register to divied by 4 or divide by 8 . on both cases, set the pm17 bit in the pm1 register to 1 (with wait state). 19.13.8 instructions prohibited in ew0 mode the following instructions cannot be used in ew0 mode because the flash memory s internal data is referenced: und instruction, into instruction, jmps instruction, jsrs instruction, and brk instruction
page 321 19. usage notes 9 2 3 f o 7 0 0 2 , 5 1 . b e f 0 0 . 2 . v e r 0 0 2 0 - 2 0 2 0 b 9 0 j e r ) t 6 2 / c 6 1 m , b 6 2 / c 6 1 m , a 6 2 / c 6 1 m ( p u o r g a 6 2 / c 6 1 m 19.13.9 interrupts ew0 mode ? any interrupt which has a vector in the variable vector table can be used, providing that its vector is transferred into the ram area. _______ ? the nmi and watchdog timer interrupts can be used because the fmr0 register and fmr1 regis- ter are initialized when one of those interrupts occurs. the jump addresses for those interrupt service routines should be set in the fixed vector table. _______ because the rewrite operation is halted when a nmi or watchdog timer interrupt occurs, the rewrite program must be executed again after exiting the interrupt service routine. ? the address match interrupt cannot be used because the flash memory s internal data is refer- enced. ew1 mode ? make sure that any interrupt which has a vector in the relocatable vector table or address match interrupt will not be accepted during the auto program period or auto erase period with erase- suspend function disabled. _______ ? the nmi interrupt can be used because the fmr0 register and fmr1 register are initialized when this interrupt occurs. the jump address for the interrupt service routine should be set in the fixed vector table. _______ because the rewrite operation is halted when a nmi interrupt occurs, the rewrite program must be executed again after exiting the interrupt service routine. 19.13.10 how to access to set the fmr01, fmr02, fmr11 or fmr16 bit to 1 , set the subject bit to 1 immediately after setting to 0 . do not generate an interrupt or a dma transfer between the instruction to set the bit to 0 and the _______ instruction to set the bit to 1 . when the pm24 bit is set to 1 (nmi funciton), apply a high-level ( h ) _______ signal to the nmi pin to set those bits. 19.13.11 writing in the user rom area ew0 mode ? if the power supply voltage drops while rewriting any block in which the rewrite control program is stored, a problem may occur that the rewrite control program is not correctly rewritten and, conse- quently, the flash memory becomes unable to be rewritten thereafter. in this case, standard serial i/o or parallel i/o mode should be used. ew1 mode ? avoid rewriting any block in which the rewrite control program is stored. 19.13.12 dma transfer in ew1 mode, make sure that no dma transfers will occur while the fmr00 bit in the fmr0 register is set to "0" (during the auto program or auto erase period). 19.13.13 regarding programming/erasure times and execution time as the number of programming/erasure times increases, so does the execution time for software com- mands (program, and block erase). _______ the software commands are aborted by hardware reset 1, hardware reset 2, nmi interrupt, and watchdog timer interrupt. if a software command is aborted by such reset or interrupt, the affected block must be erased before reexecuting the aborted command.
page 322 19. usage notes 9 2 3 f o 7 0 0 2 , 5 1 . b e f 0 0 . 2 . v e r 0 0 2 0 - 2 0 2 0 b 9 0 j e r ) t 6 2 / c 6 1 m , b 6 2 / c 6 1 m , a 6 2 / c 6 1 m ( p u o r g a 6 2 / c 6 1 m 19.13.14 definition of programming/erasure times "number of programs and erasure" refers to the number of erasure per block. if the number of program and erasure is n (n=100 1,000 10,000) each block can be erased n times. for example, if a 2k byte block a is erased after writing 1 word data 1024 times, each to a different address, this is counted as one program and erasure. however, data cannot be written to the same adrress more than once without erasing the block. (rewrite prohibited) 19.13.15 flash memory version electrical characteristics 10,000 e/w cycle products (u7, u9) when block a or b e/w cycles exceed 100, select one wait state per block access. when fmr17 is set to "1", one wait state is inserted per access to block a or b - regardless of the value of pm17. wait state insertion during access to all other blocks, as well as to internal ram, is controlled by pm17 - regardless of the setting of fmr17. to use the limited number of erasure efficiently, write to unused address within the block instead of rewite. erase block only after all possible address are used. for example, an 8-word program can be written 128 times before erase becomes necessary. maintaining an equal number of erasure between block a and b will also improve efficiency. we recommend keeping track of the number of times erasure is used. 19.13.16 boot mode an indeterminate value is sometimes output in the i/o port until the internal power supply becomes stable _____________ when "h" is applied to the cnv ss pin and "l" is applied to the reset pin. when setting the cnv ss pin to "h", the following procedure is required: ____________ (1) apply an "l" signal to the reset pin and the cnv ss pin. (2) bring v cc to more than 2.7v, and wait at least 2msec. (internal power supply stable waiting time) (3) apply an "h" signal to the cnv ss pin. ____________ (4) apply an "h" signal to the reset pin. when the cnv ss pin is h and reset pin is l , p6 7 pin is connected to the pull-up resister.
page 323 19. usage notes 9 2 3 f o 7 0 0 2 , 5 1 . b e f 0 0 . 2 . v e r 0 0 2 0 - 2 0 2 0 b 9 0 j e r ) t 6 2 / c 6 1 m , b 6 2 / c 6 1 m , a 6 2 / c 6 1 m ( p u o r g a 6 2 / c 6 1 m 19.14 noise connect a bypass capacitor (approximately 0.1 figure 19.4 bypass capacitor connection
page 324 19. usage notes 9 2 3 f o 7 0 0 2 , 5 1 . b e f 0 0 . 2 . v e r 0 0 2 0 - 2 0 2 0 b 9 0 j e r ) t 6 2 / c 6 1 m , b 6 2 / c 6 1 m , a 6 2 / c 6 1 m ( p u o r g a 6 2 / c 6 1 m 19.15 instruction for a device use when handling a device, extra attention is necessary to prevent it from crashing during the electrostatic discharge period.
appendix 1. package dimensions page 325 ) t 6 2 / c 6 1 m , b 6 2 / c 6 1 m , a 6 2 / c 6 1 m ( p u o r g a 6 2 / c 6 1 m 9 2 3 f o 7 0 0 2 , 5 1 . b e f 0 0 . 2 . v e r 0 0 2 0 - 2 0 2 0 b 9 0 j e r appendix 1. package dimensions b p a 1 h e y 0 .1 5 e 0 . 8 c 0 1 0 l 0 . 3 0 . 5 0 . 7 0 . 05 a 2.4 11. 63 11. 93 12.2 3 a 2 2. 0 e 8 . 2 8 . 4 8 . 6 d 17. 3 17. 5 1 7.7 r e f e r e n ce s y mbo l min n om m ax 0 .2 5 0 . 3 0 . 4 0 .1 3 0 .1 5 0 . 2 p- sso p42- 8 .4x17. 5 - 0 . 80 0.6 g mass[t y p. ] 4 2 p 2 r - e pr s p 00 42 g a- b rene s a s c od e jeita packa g e cod e previous c od e 0 . 65 0 . 95 2. 1 . d imen s i o n s " * 1" and " * 2" note ) d imen s i o n " * 3 " d o e s n ot in c l u de trim o ff s et . y in de x m a r k 1 42 f * 1 * 2 e h e d e b p a c de t a il f a 2 l a 1 t e rmin a l c r oss sec ti on b 1 c 1 b p c 2 . 1 . d imen s i o n s " * 1" and " * 2 " note ) d imen s i o n " * 3 " d o e s n ot in c l u de trim o ff s et . de t a il f l 1 c a l a 1 a 2 * 3 f 4 8 37 36 25 2 4 1 3 1 2 1 * 1 * 2 in de x m a r k y z e z d p e h e h d d e previous c od e jeita packa g e cod e rene s a s c od e pl q p0048kb- a 48p6 q - a mass[t y p. ] 0.2 g p-l q fp48-7x7-0.5 0 1. 0 0 .12 5 0 .2 0 0 .7 5 0 .7 5 0 . 08 0 .2 0 0 .14 5 0 . 09 0 .2 7 0 .2 2 0 .1 7 m a x n om min dimension in millimeters sy mbol r e f e r e n ce 7.1 7. 0 6 . 9 d 7.1 7. 0 6 . 9 e a 9 . 2 9 . 0 8 . 8 8 . 8 1 .7 0 . 2 0 . 1 0 0 . 65 0 . 5 0 . 35 l x 8 0 c 0 . 5 e 0.1 0 y h d e a 1 p b 1 c 1 z d z e l 1
appendix 2. functional difference page 326 9 2 3 f o 7 0 0 2 , 5 1 . b e f 0 0 . 2 . v e r 0 0 2 0 - 2 0 2 0 b 9 0 j e r ) t 6 2 / c 6 1 m , b 6 2 / c 6 1 m , a 6 2 / c 6 1 m ( p u o r g a 6 2 / c 6 1 m appendix 2. functional difference appendix 2.1 differences between m16c/26a, m16c/26b, and m16c/26t item m16c/26a, m16c/26b m16c/26t main clock during oscillating stoped and after reset (default value 0 while and after the (default value 1 while and after the cm05 bit is reset.) cm05 bit is reset.) voltage detection available not available circuit (vcr1 register, vcr2 register, (reserved register) (function of 0019 16 , d4int register) 001a 16 , 001f 16 ) package plqp0048kb-a(48p6q), prsp0042ga-b(42p2r) plp0048kb-a(48p6q) note: 1. since the emulator between the m16c/26a group and m16c/29 group are the same, all functions of m16c/29 are built in the emulator. when evaluating m16c/26a group, do not access to the sfr which is not built in m16c/26a group. refer to hardware manual about detail and electrical characteristics.
appendix 2. functional difference page 327 9 2 3 f o 7 0 0 2 , 5 1 . b e f 0 0 . 2 . v e r 0 0 2 0 - 2 0 2 0 b 9 0 j e r ) t 6 2 / c 6 1 m , b 6 2 / c 6 1 m , a 6 2 / c 6 1 m ( p u o r g a 6 2 / c 6 1 m appendix 2.2 differences between m16c / 26a group and m16c / 26 group item m16c/26a group m16c/26 group clock generation 4 circuits (main clock oscillation circuit, 3 circuits (main clock oscillation circuit, circuit sub clock oscillation circuit, sub clock oscillation circuit, on-chip oscillator, on-chip oscillator) pll frequency synthesizer) system clock on-chip oscillator main clock source after reset (initial value "1" of cm21 bit) (initial value "0" of cm21 bit) (initial value of the cm21 bit in the cm2 register) on-chip oscillator clock selectable (8mhz/1mhz/500khz) fixed (1mhz) pacr2 to pacr0 in necessary to set after reset no pacr register the pacr register 48pin:"100 2 ", 42pin:"001 2 " ifsr20 bit in the necessary to set to "1" after reset no ifsr2a register ifsr2a register external interrupt ________ 8 causes (int2 added) 7 causes 13 pin (48-pin version) ________ p8 4 /int2/zp iv cc function p7 0 , p7 1 n-ch open drain output and cmos n-ch open drain output output are selectable by s/w a/d input pin 12 channels 8 channels (48-pin version) a/d operation mode 8 modes (single, repeat, single sweep, 5 modes (single, repeat, single sweep, repeat sweep mode 0, repeat sweep repeat sweep mode 0, repeat sweep mode 1, simultaneous sampling, mode 1) delayed trigger mode 0, delayed trigger mode 1) 1 shunt current measurement function is available timer b operation 5 modes (timer, event counter, pulse 4 modes (timer, event counter, pulse mode periods measurement, pulse width periods measurement, pulse width measurment, a/d trigger) measurment) 1 shunt current measurement function is available crc calculation available (compatible to crc-ccitt not available and crc-16 methods) three-phase motor ? waveform output/switching port output ? waveform output/switching port output control by software is enabled by software is disabled ? position data retention function ? no position data retention function digital debounce _______ _____ this function is in the nmi/sd pin and not available function ________ int5 pin 3 pin (48-pin version) p9 0 /clk out /tb0 in /an3 0 p9 0 /tb0 in function (clk out : f1, f8, f32, and f c output) uart1 compatible switching to p6 4 to p6 7 or p7 0 to p7 3 p6 4 to p6 7 pin is enabled flash memory protection to blocks 0, 1 by fmr02 bit protection to blocks 0,1 by fmr02 bit protect function protection to the blocks 0 to 3 by fmr16 bit package plqp0048kb-a(48p6q), prsp0042ga-b(42p2r) plqp0048kb-a(48p6q) note: 1. since the emulator between the m16c/26a group and m16c/29 group are the same, all functions of m16c/29 are built in the emulator. when evaluating m16c/26a group, do not access to the sfr which is not built in m16c/26a group. refer to hardware manual about detail and electrical characteristics.
register index page 328 9 2 3 f o 7 0 0 2 , 5 1 . b e f 0 0 . 2 . v e r 0 0 2 0 - 2 0 2 0 b 9 0 j e r ) t 6 2 / c 6 1 m , b 6 2 / c 6 1 m , a 6 2 / c 6 1 m ( p u o r g a 6 2 / c 6 1 m register index a ad0 to ad7 184 adcon0 to adcon2 182 adic 67 adstat0 184 adtrgcon 183 aier 79 b bcnic 67 c cm0 40 cm1 41 cm2 42 cpsrf 96 , 110 crcd 214 crcin 214 crcmr 214 crcsar 214 d d4int 30 dar0 86 dar1 86 dm0con 85 dm0ic 67 dm0sl 84 dm1con 85 dm1ic 67 dm1sl 85 dtt 121 f fmr0 241 fmr1 241 fmr4 242 i ictb2 121 idb0 121 idb1 121 ifsr 68 , 76 ifsr2a 68 int0ic to int2ic 67 int3ic 67 int4ic 67 int5ic 67 invc0 119 invc1 120 k kupic 67 n nddr 227 o onsf 96 p p0 to p13 224 p17ddr 227 pacr 139 , 226 pclkr 43 pcr 226 pd0 to pd13 223 pdrf 129 pfcr 131 plc0 44 pm0 35 pm1 35 pm2 36 , 43 prcr 60 pur0 to pur2 225 r rmad0 79 rmad1 79 rocr 41 romcp 236 s s0ric to s2ric 67 s0tic to s2tic 67 sar0 86 sar1 86
register index page 329 9 2 3 f o 7 0 0 2 , 5 1 . b e f 0 0 . 2 . v e r 0 0 2 0 - 2 0 2 0 b 9 0 j e r ) t 6 2 / c 6 1 m , b 6 2 / c 6 1 m , a 6 2 / c 6 1 m ( p u o r g a 6 2 / c 6 1 m t ta0 to ta4 95 ta0ic to ta4ic 67 ta0mr to ta4mr 94 ta1 122 ta11 122 ta1mr 125 ta2 122 ta21 122 ta2mr 125 ta2mr to ta4mr 101 ta4 122 ta41 122 ta4mr 125 tabsr 95 , 110 , 124 taimr 99 , 106 tb0 to tb5 110 tb0ic to tb2ic 67 tb0mr to tb5mr 109 tb2 124 tb2mr 125 tb2sc 123 , 185 tcr0 86 tcr1 86 tprc 131 trgsr 96 , 124 u u0brg to u2brg 136 u0c0 to u2c0 138 u0c1 to u2c1 139 u0mr to u2mr 137 u0rb to u2rb 136 u0tb to u2tb 136 u2smr 140 u2smr2 140 u2smr3 141 u2smr4 141 ucon 138 udf 95 v vcr1 30 vcr2 30 w wdc 81 wdts 81
revision history m16c/26a group (m16c/26a, m16c/26b, m16c/26t) hardware manual rev. date description page summary c-1 2.00 feb.15,07 - m16c/26b newly added, word standardized: on-chip oscillator, development tool overview 1 ?escription partially deleted 2 - 3 1.2 performance outline modified 4 - 5 figure 1.1 and 1.2 block diagrams updated 6 1.4 product list updated 7 figure 1.3 product numbering system updated 8 tables 1.7 to 1.10 product codes updated 12, 14 tables 1.11 and 1.12 pin characteristics newly added 15 - 16 tables 1.13 pin description newly added sfrs 20 ?able 4.1 sfr information(1) note about wdc register is deleted 22 table 4.3 sfr information(3) value after reset for rocr register modified 23 table 4.4 sfr information(4) note 2 added to ifsr2a register reset 28 figure 5.1.1.2. reset sequence vcc line and roc line are modified 29 figure 5.5.1. voltage detection circuit block wdc register? block is deleted processor mode 35 figure 6.1 pm1 register note 2 partially added 36 figure 6.2 pm2 register newly added 37 figure 6.3 bus block diagram and table 6.1 accessible area and bus cycle newly added c lock generation circuit 41 figure 7.4 rocr register modified 43 figure 7.6 pm2 registe r notes 2, 5, 6 modified 45 - 46 figure 7.1.1 and 7.2.1 examples of main clock connection circuit updated 47 ? .4 pll clock description modified for m16c/26b table 7.4.1 example for setting pll clock frequencies note 1 modified 50 7.6.1 normal operation mode description modifie d 51 ?able 7.6.1.1 setting clock related bit and modes modified 54 figure 7.6.1 state transition to stop mode and wait mode modified 55 figure 7.6.1.1. state transtion in normal mode modified 56 table 7.6.1 allowed transition and setting modified , notes 1 and 2 modified 59 figure 7.8.3.1 procedure to switch clock source from on-chip oscillator to main clock upadated protection 60 ?escription partially modified interrupt 76 ______ 9.6 int interrupt description partially added
revision history m16c/26a group (m16c/26a, m16c/26b, m16c/26t) hardware manual rev. date description page summary c-2 77 ______ 9.7 nmi interrupt description partially added 78 table 9.9.1 value of the pc that is saved to the stack area when an address match interrupt request is accepted modified, note 1 added watchdog timer - ?ection of cold start/warm start deleted 80 ?escription partially added figure 10.1 watchdog timer block diagram partially modified 81 figure 10.2 wdc register and wdts register notes deleted, wdc5 bit de- leted 10.1 count source protective mode description partially added timer 108 ?escription about a/d trigger mode modified figure 12.2.1 timber b block diagram a/d trigger mode added 115 12.2.4 a/d trigger mode description modified 121 figure 12.3.4 idb0 register, idb1 register, dtt register, and ictb2 regis- ter modified 123 figure 12.3.6 tb2sc register modified, note 4 added 131 figure 12.3.2.2 tprc register bit map modified serial i/o 133 figure 13.1.1 block diagram of uarti (i = 0 to 2) pll clock added 136 figure 13.1.4 u0tb to u2tb registers, u0rb to u2rb registers, u0brg to u2brg registers modified, note 3 for uibrg added 138 figure 13.1.6 u0c0 to u2c0 registers note 2 modified, note 7 added 139 figure 13.1.7 pacr register note 1 modified 142 table 13.1.1.1 clock synchronous serial i/o mode specification note 2 modi- fied 145 figure 13.1.1.1 typical transmit/receive timings in clock synchronous serial i/o mode partially modified 150 table 13.1.2.1 uart mode specifications note 1 modified 154 figure 13.1.2.2 receive operation figure modified 158 table 13.1.3.1 i 2 c bus mode specifications note 2 modified 168 table 13.1.4.1 special mode 2 specifications note 2 modified 175 table 13.1.6.1 sim mode specifications note 1 modified 177 figure 13.1.6.1 transmit and receive timing in sim mode timing modified a/d converter 180 table 14.1 a/d converter performance note 2 partially added 183 table 14.2 a/d conversion frequency select note 1 partially added 205 table 14.1.8.1 delayed trigger mode 1 specifications note 1 modified 212 figure 14.5.1 analog input pin and external sensor equivalent circuit note
revision history m16c/26a group (m16c/26a, m16c/26b, m16c/26t) hardware manual rev. date description page summary c-3 1 added crc calculation circuit 213 15.1 crc snoop description partially modified 214 figure 15.2 crcsar register note 1 added programable i/o ports 216 16.3 pull-up control register 0 to pull-up control register 2 description modified 217 16.6 digital debounce function equation modified 218 - 221 figure 16.1 i/o ports (1) to 16.4 i/o ports (4) modified 227 figure 16.6.1 nddr and p17ddr registers equation modified, note 2 modi- fied flash memory version 231 17.1.1 boot mode newly added 232 17.2 memory map partially deleted 235 17.3.1 rom code protect function description modified 236 figure 17.3.1.1 romcp address modified 237 table 17.4.1 ew0 mode and ew1 mode note 2 mark deleted 239 17.5.1 flash memory control register 0 description about low power con- sumption mode or on-chip oscillator low-power consumption mode is entered partially modified 240 17.5.2 flash memory control register 1 description about fmr17 bit modified 241 figure 17.5.1 fmr0 register note 3 modified, fmr1 register: bit map modi- fied 242 figure 17.5.2 fmr4 register note 2 modified 243 figure 17.5.1.2 setting and resetting of ew1 mode note for single-chip mode deleted, note 3 for fmr11 bit added electrical characteristics 261 table 18.1 absolute maximum ratings rated value modifed, note 1 added 262 table 18.2 recommended operating conditions value partially added, fig- ures in note 4 partially added 263 table 18.3 a/d conversion characteristics note 4 modified 264 table 18.4 and table 18.5 flash memory version electrical characteristic note 4 partially added, note 6 and note 7 modified 265 ?able 18.6 voltage detection circuit electrical characteristics conditions modi- fied ?igure for td(p-r) and td(roc) modified 267 table 18.9 eelectrical characteristics (2) flash memory? value for m16c/26b added, note 5 deleted 274 table 18.24 electrical characteristics (2) note 5 deleted
revision history m16c/26a group (m16c/26a, m16c/26b, m16c/26t) hardware manual rev. date description page summary c-4 283 tables 18.41 and 18.42 flash memory version electrical characteristics note 4 , note 10, note 11 modified 284 ?igure for td(p-r) and td(roc) modified 286 table 18.45 electrical characteristics note 4 deleted 293 table 18.60 electrical characteristics (2) note 4 deleted usage notes 299 19.1.3 register setting newly added 306 19.5.6 rewrite the interrupt control register example 1 modified 312 19.7.3 three-phase motor control timer function newly added 315 19.9 a/d converter description of section 6 modified 319 19.12.1 internal rom area description partially added 321 19.13.9 interrupts description of ew1 mode modified, note on watchdog timer interrupts deleted 19.13.10 how to access description modified appendix 2. functional difference 326 appendix 2.1 differences between m16c/26a and m16c/26t description on cold start/warm start detection function deleted
? 2007. renesas technology corp., all rights reserved. printed in japan. renesas 16-bit cmos single-chip microcomputer hardware manual m16c/26a group (m16c/26a, m16c/26b, m16c/26t) publication date: rev.1.00 mar.15, 2005 rev.2.00 feb.15, 2007 published by: sales strategic planning div. renesas technology corp.
m16c/26a group (m16c/26a, m16c/26b, m16c/26t) hardware manual 2-6-2, ote-machi, chiyoda-ku, tokyo, 100-0004, japan


▲Up To Search▲   

 
Price & Availability of M30260M3A-XXXGP

All Rights Reserved © IC-ON-LINE 2003 - 2022  

[Add Bookmark] [Contact Us] [Link exchange] [Privacy policy]
Mirror Sites :  [www.datasheet.hk]   [www.maxim4u.com]  [www.ic-on-line.cn] [www.ic-on-line.com] [www.ic-on-line.net] [www.alldatasheet.com.cn] [www.gdcy.com]  [www.gdcy.net]


 . . . . .
  We use cookies to deliver the best possible web experience and assist with our advertising efforts. By continuing to use this site, you consent to the use of cookies. For more information on cookies, please take a look at our Privacy Policy. X